lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Get list with found words for a hit?
Date Wed, 01 Mar 2006 21:33:30 GMT

: Is there a way to retrieve only the search "words" the user entered in BNF form?
: Query  ::= ( Clause )*
: Clause ::= ["+", "-"] [<TERM> ":"] ( <TERM> | "(" Query ")" )
:
: For example the user entered: +Paris -London
:
: I want to get a List that contains only {Paris, London}

your use of "TERM" is a little vauge.  assuming for grammer is designed to
be a subset of the QueryParser syntax, then a field name is a term, as is
the tokens you are searching in each field correct?  if your input is
"+Paris: -content:London" you want the list {Paris, content, London} ?

Something you might want to look at is the Query.extractTerms(Set) method.
it should definitely work if all you are ever dealing with is simple
Boolean and Term Queries.  Some of the more exotic query types won't work
however.

(Bear in mind it extracts "Terms" in the org.apache.lucene.index.Term sense)



-Hoss


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


Mime
View raw message