Standard anlyzer/tokenizer will use white space and other punctuation to delimit tokens. The rules are a little complicated (although I tried to summarize them for Solr in my book) - the same rules apply for Lucene.

Verify that you are properly constructing a PhraseQuery from your analyzed text at query time. What is the exact query text and what are the exact analyzer tokens for that query text and how many are there?

-- Jack Krupansky

-----Original Message----- From: Ankit Murarka
Sent: Monday, July 22, 2013 10:29 AM
To: java-user@lucene.apache.org
Subject: Re: Trying to search java.lang.NullPointerException in log file.

First thing first : Same analyzer is being used to index and to search.

Now, I am not using any custom analyzer to split the string and get the
tokens. I was assuming StandardAnalyzer might be using whitespaces to
split the content. If that is not the case then I must have got it
completely wrong.

So for searching "java.lang.NullPointer" how should I proceed? This
string might be present after : like ":java.lang.NullPointer" . In both
cases I want to search for "java.lang.NullPointer" only.


On 7/22/2013 7:51 PM, Jack Krupansky wrote:
"This is because the StandardAnalyzer must be splitting the words on "SPACES" and since there is no space present here. The entire string is converted into 1 token."

Those statements are inconsistent! I mean, what code is converting the entire string to 1 token and eliminating white space? Is that your own code before you hand the string to the standard analyzer??? That makes no sense. I mean, the standard analyzer is using the standard tokenizer that doesn't do that!

Are you applying the same analyzer at query time as you do at index time? It is not uncommon for Lucene users to forget to do that. If you don't, then you will have to hand-analyze the query string and simulate exactly what the standard analyzer did at index time.

So, please clarify your situation.


-- Jack Krupansky

-----Original Message----- From: Ankit Murarka
Sent: Monday, July 22, 2013 6:24 AM
To: java-user@lucene.apache.org
Subject: Trying to search java.lang.NullPointerException in log file.

Hello. I am trying to search java.lang.NullPointerException in a log
file. The log file is huge.

However I am unable to search it. This is because the StandardAnalyzer
must be splitting the words on "SPACES" and since there is no space
present here. The entire string is converted into 1 token.

What can be a possible way of finding
"Exception:java.lang.NullPointerException" in a log file.

The string may be different also. Suppose "Exception:
java.lang.NullPointerException error occured"

I am trying to use Phrase Query but I am not sure if that will serve the
purpose.

Can please someone suggest.



--
Regards

Ankit Murarka

"Peace is found not in what surrounds us, but in what we hold within."


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to