lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Search Design Question
Date Fri, 23 Mar 2007 19:49:13 GMT
I don't believe there's anything built into Lucene that helps you out here
because you're really saying "do special things for my problem space
in these situations".

So about the only thing you can do that I know of is to construct the
query yourself by making a series of additions to BooleanQuery
based on your particular problem space.

Which you have to do anyway because you want to turn a simple
michael query into
to:michael from:micheal contents:michael subject:michael
(note default or)....

So you'll have to do something like
if (term has colon) {
    just add boolean clause for that term in that field
} else {
   add all four clauses
}

However, be warned...... this is not a trivial task if you want to
support arbitrary grouping, implement precedence, etc. Search
the list for "bad query bug" for an explanation, or go to the FAQ and
look at something like "why don't I get what I expect from queries".
In fact, you really need to look at and understand that FAQ entry
before you let Lucene loose on queries with AND, OR and NOT
in them. It'll be well worth your time......

One final note, it may be much easier for you to throw all the
fields into a single uber-field and search that rather than implement
all four separate clauses, but it's a trade off between simplicity and
size.....

Best
Erick

On 3/23/07, Michael J. Prichard <michael_prichard@mac.com> wrote:
>
> Hello All,
>
> We allow our users to search through our index with a simple textfield.
> The search phrase has "content" as its default value.  This allows them
> to search quickly through content but then when they type "to:blah AND
> from:foo AND content:boogie" it will know to parse,etc.
>
> What I want to do it expand it so when they type a phrase in the
> textfield it will search select all at once and still be smart enough to
> recognize a lucene query.
>
> For example,  say we have these fields:
>
> to
> from
> content
> subject
>
> When I type "michael contract negotiation" it will look through all
> these fields and return hits.
>
> Then it should be able to recognize more advance searches like:
>
> to:michael AND content:foo
>
> and not go through all fields....
>
> Am I making sense?  Is this a good way to provide search?  How would I
> do this?
>
> Thanks,
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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