Perforce Public Knowledge Base - P4Search Log Files and Troubleshooting Search Problems
× PRODUCTS SOLUTIONS CUSTOMERS LEARN SUPPORT
Downloads Company Partners Careers Contact Free Trials
Menu Search
Perforce
Reset Search
 

 

Article

P4Search Log Files and Troubleshooting Search Problems

« Go Back

Information

 
Problem
How can I determine if the P4Search application is processing files? 

My search doesn't find any files - why?

This document applies to P4Search 2014.1.
Solution
This document assumes you've deployed P4Search as packaged from our download site and start the p4search process by running:
cd <p4search-install>
./install/start.sh

P4Search Web App

This app controls indexing the files and front-ends all searches.  The searches can be run from the P4Search Web UI or from Commons. The log file can be found in:
<p4search-install>/start.log

To confirm files are being indexed, increase the logging by editing <p4search-install>/install/jetty-distrib*/resource/log4j.properties and adding:
log4j.category.com.perforce.search.manager=DEBUG

You must restart the p4search web app to pick up log4j.properties changes.

Sample log for a submit of file //depot/devxml/src/README:
259733 [Thread-15] DEBUG com.perforce.search.manager.impl.QueueManagerImpl - Adding //depot/devxml/src/README 
259733 [Thread-18] INFO com.perforce.p4java.extension.server.internal.ServerConnectionPool - creating a new connecting to the server... 
259764 [Thread-18] DEBUG com.perforce.search.manager.FileQueueIndexThread - indexing //depot/devxml/src/README 
260213 [Thread-18] DEBUG com.perforce.search.manager.FileQueueIndexThread - done with //depot/devxml/src/README

To see the files found in a search, add this to log4j.properties:
log4j.category.com.perforce.p4java.extension.server=DEBUG
You should now see the output listing the files found when search for pickles:
 
46248 [qtp779597446-16] DEBUG com.perforce.search.manager.impl.SearchIndexManagerImpl - Searching for: {!boost b=recip(ms(NOW,modifiedtime),3.16e-11,1,1)}((filename:pickles OR filename:*pickles*) OR ("pickles"~100)) AND (headrevision:true) 
46371 [qtp779597446-16] DEBUG com.perforce.p4java.extension.server.internal.ServerImpl - EXEC >>> p4 files //depot/devxml/src/README //depot/dev/src/file.bin //depot/main/src/file.bin
For this example, the search found three files in the solr index.  If the command was simply "p4 files" then no files were found.

Solr Web App

This is a packaging of Apache Solr (http://lucene.apache.org/solr/), configured with a schema to handle Perforce files and meta data.
Log file:  <p4search-install>/install/logs/solr.log

To check for which files are indexed, search the log for "{add=[//"

Sample:
$ grep "\{add=\[//" solr.log 
INFO - 2015-04-02 10:17:07.444; org.apache.solr.update.processor.LogUpdateProcessor; [collection1] 
webapp=/solr path=/update/extract params={literal.filename=README
&literal.filesize=29&literal.modifiedby=jbrown&literal.depotpath=depot&literal.depotpath=devxml
&literal.depotpath=src&literal.depotrevision=2&literal.id=//depot/devxml/src/README
&literal.modifiedtime=Thu+Apr+02+10:17:10+PDT+2015&literal.headrevision=true&wt=javabin
&literal.digest=2B5C334E4FA3BE889BD8EEF6A2C69C0E&version=2} 
{add=[//depot/devxml/src/README (1497361313861468160)]} 0 652
 

My Search Fails to Find Files

You know the file should be found but your search results does not return the file.

Use the above logging to determine the file was found in solr.  There are typically two reasons why search values aren't found with the P4Search UI or Commons but are found in solr:
  1. the ticket to the Perforce Server isn't valid.    This is likely to only to occur when searching through Commons.
  2. the user does not have permission to access the file
For 1, first check the p4search log for errors related to accessing the Perforce Server.   See the below section on Commons Search Never Returns Results.

For 2, make sure your log4j.properties contains:
log4j.category.com.perforce.search.manager=DEBUG
log4j.category.com.perforce.p4java.extension.server=DEBUG
And that you have restarted the p4search web app after changing log4j.properties.

Sample log output when search for "pickles":
46248 [qtp779597446-16] DEBUG com.perforce.search.manager.impl.SearchIndexManagerImpl
- Searching for: {!boost b=recip(ms(NOW,modifiedtime),3.16e-11,1,1)}
((filename:pickles OR filename:*pickles*) OR ("pickles"~100)) AND (headrevision:true)

46371 [qtp779597446-16] DEBUG com.perforce.p4java.extension.server.internal.ServerImpl  
- EXEC >>> p4 files //depot/devxml/src/README //depot/dev/src/file.bin //depot/main/src/file.bin
 
 

As a super user, repeat the "p4 files" command while impersonating the user running the query:
$ p4 login testuser
 User testuser logged in. 

$ p4 -u testuser files //depot/devxml/src/README //depot/dev/src/file.bin //depot/main/src/file.bin 
//depot/devxml/src/README - protected namespace - access denied. 
//depot/dev/src/file.bin#3 - edit change 81 (binary) 
//depot/main/src/file.bin#1 - add change 77 (binary)
The above would explain why README is not returned in your search results
 

Commons Search Never Returns Results

Check the p4search log file.  If you see errors related to login for the user running the search verify the commons.config file property com.perforce.commons.config.externalSearchIP is the IP address of the machine running p4search.   Use 127.0.0.1 only if the Perforce server is on the exact same machine.


Using the Solr Admin Console

Solr ships with an admin console that you can use to run queries against your P4Search DB. By default this runs on port '127.0.01:8993' of the P4Search machine and the query URL is (must run on the P4Search machine):

   http://localhost:8983/solr/#/collection1/query

Queries appear in the 'solr.log' (as mentioned above) and can be tested directly in the interface. For example when searching for the text 'f1' the following log entry is seen:
 
INFO  - 2016-03-10 16:39:51.705; org.apache.solr.core.SolrCore; [collection1] webapp=/solr 
path=/select params={fl=id,score,modifiedby&start=0&q={!boost+b%3Drecip(ms(NOW,modifiedtime),3.16e-11,1,1)}
((filename:f1+OR+filename:*f1*)+OR+("f1"~100))+AND+(headrevision:true)
&wt=javabin&collectionName=collection1&version=2&rows=10} hits=4 status=0 QTime=56

This can be input as the following query using Solr admin:

Solr Admin Example



 
Related Links

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255