Re: Custom query parser

2007-11-22 Thread Mike Klaas
On 22-Nov-07, at 8:49 AM, Nicolas Lalevée wrote: Le jeudi 22 novembre 2007, Matthijs Bierman a écrit : Hi Nicolas, Why can't you extend the QueryParser and override the methods you want to modify? Because the query parser I would like to have is a very basic user one, ala google. The s

Where to place a filter...

2007-11-22 Thread Christian Aschoff
Hello, as a prolog, i have no problems and everything works the way i want :-) I am more interested in a tip if i am using the right way or pattern. I want to strip accents before data goes into my index, so i wrote the code following below. I did not find an example of where to place a fi

Re: help required urgent!!!!!!!!!!!

2007-11-22 Thread Matthijs Bierman
Hi Simply create your own analyzer with JavaCC. See the repository for the latest StandardAnalyzer.jj file, make sure the Analyzer accepts anything with a hypen as a single token. And try not to yell, please. Most of the questions are urgent, there is no need for emphasis - especially in this

Re: Custom query parser

2007-11-22 Thread Nicolas Lalevée
Le jeudi 22 novembre 2007, Matthijs Bierman a écrit : > Hi Nicolas, > > Why can't you extend the QueryParser and override the methods you want > to modify? Because the query parser I would like to have is a very basic user one, ala google. The syntax I would like is nothing more than : "type:text

Re: help required urgent!!!!!!!!!!!

2007-11-22 Thread Shai Erera
Yep - that's a good one. Only it may be a very heavy query, and throw TooManyClausesException, if the number of terms that start with the prefix is too much. But that certainly would work. BTW - MultiPhraseQuery's documentation specifically explains how to use it for exactly the same purpose. On N

Re: help required urgent!!!!!!!!!!!

2007-11-22 Thread Shai Erera
The thing is - StandardAnalyzer breaks on hyphen. You'll need to work around this by either extend StandardAnalyzer >From StandardTokenizer's documentation (which is used by StandardAnalyzer): **Splits words at hyphens, unless there's a number in the token, in which case * the whole token

Re: help required urgent!!!!!!!!!!!

2007-11-22 Thread mark harwood
>>Re: help required urgent!!! Yikes!! I'm guessing that the question was more about how to support this in the standard query syntax where there are multiple words. i.e. http://www.google.com/search?q=lucene+wildcard+in+phrase This post seems close

Re: Force MultiFieldQueryParser always to use PrefixQuery

2007-11-22 Thread Shai Erera
Hi I wrote the following class: public class AlwaysPrefixMultiFieldQP extends MultiFieldQueryParser { public MyQP(String[] fields, Analyzer analyzer) { super(fields, analyzer); } protected Query getFieldQuery(String field, String queryText) throws ParseEx

RE: help required urgent!!!!!!!!!!!

2007-11-22 Thread Shakti_Sareen
Hi But the file I am indexing is very big and I don't know which word will contain the hyphen. The thing you suggest can be implemented only if there are some specific words in the file. Apart from StandardAnalyzer I have got no option. Thanks a lot for your reply. Please suggest me how can I g

Re: help required urgent!!!!!!!!!!!

2007-11-22 Thread Shai Erera
Hi You can simply create a PrefixQuery. However, if you're using StandardAnalyzer, and the word is added as Index.TOKENIZED, sotf-wa will be broken to 'soft' and 'wa'. Therefore you'll need to add the word as Index.UN_TOKENIZED, or use a different Analyzer when you index the data (for this field a

help required urgent!!!!!!!!!!!

2007-11-22 Thread Shakti_Sareen
Hi I am using StandardAnalyser() to index the data. But I want to do a like search on a word containing Hyphen For example it want to search a word "soft-wa*" I am getting no hits for that. It is said that if the hyphen is there in the word, then we should include that word in the double quotes (

Re: AND query in SHOULD

2007-11-22 Thread Shai Erera
How about using MultiFieldQueryParser. Here is a short main I wrote: Directory dir = new RAMDirectory(); Analyzer analyzer = new StandardAnalyzer(); IndexWriter writer = new IndexWriter(dir, analyzer); Document doc = new Document(); doc.add(new Field("field1

Re: Force MultiFieldQueryParser always to use PrefixQuery

2007-11-22 Thread Erick Erickson
The simplest way would be to pre-process the query. That is, just split on words and add the '*' as appropriate. Erick On Nov 21, 2007 2:16 PM, Anders Lybecker <[EMAIL PROTECTED]> wrote: > How do I force the MultiFieldQueryParser to interpret a string like > "dock boat" as "dock* boat*" and ther

Re: AND query in SHOULD

2007-11-22 Thread Erick Erickson
The semantics of the phrase query you're constructing probably aren't what you think. As best I can infer, you are trying to do something like "green tree" in field1 or "green tree" in field 2 but that's not even close to what you're constructing. It would help a show what the query you want is

Re: AND query in SHOULD

2007-11-22 Thread Rapthor
There is no option to provide an Occur.SHOULD to the PhraseQuery. So where does it go? I changed the source to look like this: PhraseQuery pq = new PhraseQuery(); for (String word : words) { for (String field : fields) { pq.add(new Term(field, word)); } } Hits hits

Re: AND query in SHOULD

2007-11-22 Thread Daniel Naber
On Donnerstag, 22. November 2007, Rapthor wrote: > I want to realize a search that finds the exact phrase I provide. You simply need to create a PhraseQuery. See http://lucene.zones.apache.org:8080/hudson/job/Lucene-Nightly/javadoc/org/apache/lucene/search/PhraseQuery.html Regards Daniel --

AND query in SHOULD

2007-11-22 Thread Rapthor
Hi, I want to realize a search that finds the exact phrase I provide. If the word I am searching for is "green tree", I do NOT want to get results for "green" or "tree", but only results for "green tree" within the given field. This doesn't work so far for me. When providing a word that contains

Re: Custom query parser

2007-11-22 Thread Matthijs Bierman
Hi Nicolas, Why can't you extend the QueryParser and override the methods you want to modify? Cheers, Matthijs Nicolas Lalevée wrote: Hi, I am willing to have a query parser which is fault tolerant. I have search over the archive, and I have found this : http://www.nabble.com/Error-tolera