lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: Specific string query search
Date Tue, 14 Nov 2006 13:28:29 GMT
Well, if none of the regular analyzers meet your needs, you can always roll
your own. There is an example of a SynonymAnanlyzer in Lucene In Action that
you can use as a model. It's not very difficult (although a bit arcane).

You're right, WhitespaceAnalyzer doesn't respect case. But it should work
for the FIELD:TEXT kind of searches. When you say it doesn't work, what
exactly are you seeing? Have you used luke to examine your index? You can
use Luke to see how the WhitespaceAnalyzer rewrites your query, that'll tell
you a lot.

You can always lowercase your input stream yourself both at index time and
at search time....

But I have to ask: What is the value of indexing and searching on things
like colons? Would your application be better served by just letting the
analyzers do their work? Then SimpleAnalyzer or StopAnalyzer might be all
you need (since they lowercase).

You also might investigate UN_TOKENIZED storage in your index, although you
then have to take care when constructing your query.


On 11/14/06, Gaurav Kalra <> wrote:
> Hi all,
> I have a specific string query like "Jakarta:" How do i get that? I am
> using standardAnalyzer and it seems as if it is stripping ":" and it is
> simply searching for "Jakarta".
> I have used WhiteSpaceAnalyzer also and its working fine for ":" but I
> think it has some other limitations. The limitations of WhiteSpaceAnalyzer
> which I have noticed are as follows:
> 1. It needs the search criteria in the proper case i.e for searching
> "Jakarta" I cant give "jakarta" as my search criteria.
> 2. WhiteSpaceAnalyzer is not supporting FIELD:TEXT kind of search.
> e.g ISSUE_TITLE:test
> where ISSUE_TITLE is the field in which test is to be searched. But
> standardAnalyzer supports this.
> May be the limitations I am seeing is because of my code.
> Can you please help me out as to how I can do a search like "Jakarta:". I
> would appreciate if could please send me the code snippet doing this kind
> of search.
> Thanks & Regards
> Gaurav Kalra
> The information contained in this e-mail and any accompanying documents
> may contain information that is confidential or otherwise protected from
> disclosure. If you are not the intended recipient of this message, or if
> this message has been addressed to you in error, please immediately alert
> the sender by reply e-mail and then delete this message, including any
> attachments. Any dissemination, distribution or other use of the contents of
> this message by anyone other than the intended recipient
> is strictly prohibited.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message