Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

lucene Front-end match

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


yeshuangming at gmail

Sep 19, 2008, 2:05 AM

Post #1 of 7 (961 views)
Permalink
lucene Front-end match

Hi, all!

How to implement Front-end match use lucene?
Say, two Documents in index:
Document<stored/uncompressed,indexed<field:abc>>
Document<stored/uncompressed,indexed<field:bcd>>

How can I get the first Document buy some query string like "a" , "ab" or
"abc" but no "b" and "bc"?

Any input is appreciate!

--
Sorry for my English!! 明
Please help me correct my English expression and error in syntax


karl.wettin at gmail

Sep 19, 2008, 2:39 AM

Post #2 of 7 (907 views)
Permalink
Re: lucene Front-end match [In reply to]

19 sep 2008 kl. 11.05 skrev 叶双明:

> Document<stored/uncompressed,indexed<field:abc>>
> Document<stored/uncompressed,indexed<field:bcd>>
>
> How can I get the first Document buy some query string like "a" ,
> "ab" or
> "abc" but no "b" and "bc"?

You would create an ngram filter that create grams from the first
position only. Take a look at EdgeNGramTokenFilter in contrib/analyzers.


karl



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


yeshuangming at gmail

Sep 19, 2008, 3:01 AM

Post #3 of 7 (902 views)
Permalink
Re: lucene Front-end match [In reply to]

Thanks!

Now, I just use Query query = qp.parse("a*"); and meet the my requirements.

Another question: how to parser query string like: title:"The
Right Way" AND text:go
please show me in java code. thanks.

2008/9/19 Karl Wettin <karl.wettin [at] gmail>

>
> 19 sep 2008 kl. 11.05 skrev 叶双明:
>
> Document<stored/uncompressed,indexed<field:abc>>
>> Document<stored/uncompressed,indexed<field:bcd>>
>>
>> How can I get the first Document buy some query string like "a" , "ab" or
>> "abc" but no "b" and "bc"?
>>
>
> You would create an ngram filter that create grams from the first position
> only. Take a look at EdgeNGramTokenFilter in contrib/analyzers.
>
>
> karl
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


--
Sorry for my English!! 明
Please help me correct my English expression and error in syntax


yeshuangming at gmail

Sep 19, 2008, 8:44 AM

Post #4 of 7 (894 views)
Permalink
Re: lucene Front-end match [In reply to]

I am sorry, just put the string to QueryParser.
But what make me confusing the code:

Query query = qp.parse("bbb:\"b*\" AND ccc:\"cc*\"");

doesn't work as i have expected. It drop the Wildcard *.


2008/9/19, 叶双明 <yeshuangming [at] gmail>:
>
> Thanks!
>
> Now, I just use Query query = qp.parse("a*"); and meet the my
> requirements.
>
> Another question: how to parser query string like: title:"The
> Right Way" AND text:go
> please show me in java code. thanks.
>
> 2008/9/19 Karl Wettin <karl.wettin [at] gmail>
>
>>
>> 19 sep 2008 kl. 11.05 skrev 叶双明:
>>
>> Document<stored/uncompressed,indexed<field:abc>>
>>> Document<stored/uncompressed,indexed<field:bcd>>
>>>
>>> How can I get the first Document buy some query string like "a" , "ab" or
>>> "abc" but no "b" and "bc"?
>>>
>>
>>
>> You would create an ngram filter that create grams from the first position
>> only. Take a look at EdgeNGramTokenFilter in contrib/analyzers.
>>
>>
>> karl
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
>> For additional commands, e-mail: java-user-help [at] lucene
>>
>>
>
>
> --
> Sorry for my English!! 明
> Please help me correct my English expression and error in syntax
>



--
Sorry for my English!! 明
Please help me correct my English expression and error in syntax


mhall at informatics

Sep 19, 2008, 8:52 AM

Post #5 of 7 (891 views)
Permalink
Re: lucene Front-end match [In reply to]

The reason the wildcard is being dropped is because you have wrapped it
in a phrase query. Wildcards are not supported in Pharse Queries. At
least not in any Analyzers that I'm aware of.

A really good tool to see the transformations that happen to a query is
Luke, open it up against your index, go into the search section, choose
the analyzer you use and start playing around.

This has helped me countless times when creating I'm my own queries and
not getting the results that I expect.

-Matt

叶双明 wrote:
> I am sorry, just put the string to QueryParser.
> But what make me confusing the code:
>
> Query query = qp.parse("bbb:\"b*\" AND ccc:\"cc*\"");
>
> doesn't work as i have expected. It drop the Wildcard *.
>
>
> 2008/9/19, 叶双明 <yeshuangming [at] gmail>:
>
>> Thanks!
>>
>> Now, I just use Query query = qp.parse("a*"); and meet the my
>> requirements.
>>
>> Another question: how to parser query string like: title:"The
>> Right Way" AND text:go
>> please show me in java code. thanks.
>>
>> 2008/9/19 Karl Wettin <karl.wettin [at] gmail>
>>
>>
>>> 19 sep 2008 kl. 11.05 skrev 叶双明:
>>>
>>> Document<stored/uncompressed,indexed<field:abc>>
>>>
>>>> Document<stored/uncompressed,indexed<field:bcd>>
>>>>
>>>> How can I get the first Document buy some query string like "a" , "ab" or
>>>> "abc" but no "b" and "bc"?
>>>>
>>>>
>>> You would create an ngram filter that create grams from the first position
>>> only. Take a look at EdgeNGramTokenFilter in contrib/analyzers.
>>>
>>>
>>> karl
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
>>> For additional commands, e-mail: java-user-help [at] lucene
>>>
>>>
>>>
>> --
>> Sorry for my English!! 明
>> Please help me correct my English expression and error in syntax
>>
>>
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


mhall at informatics

Sep 19, 2008, 8:56 AM

Post #6 of 7 (900 views)
Permalink
Re: lucene Front-end match [In reply to]

To be more specific (just in case you are new to lucene)

Your Query:

Query query = qp.parse("bbb:\"b*\" AND ccc:\"cc*\"");

What I think you actually want here:

Query query = qp.parse("bbb:b* AND ccc:cc*");

Give it a shot, and then like I said, go get Luke, it will help you
tremendously ^^

Matthew Hall wrote:
> The reason the wildcard is being dropped is because you have wrapped
> it in a phrase query. Wildcards are not supported in Pharse Queries.
> At least not in any Analyzers that I'm aware of.
>
> A really good tool to see the transformations that happen to a query
> is Luke, open it up against your index, go into the search section,
> choose the analyzer you use and start playing around.
>
> This has helped me countless times when creating I'm my own queries
> and not getting the results that I expect.
>
> -Matt
>
> 叶双明 wrote:
>> I am sorry, just put the string to QueryParser.
>> But what make me confusing the code:
>>
>> Query query = qp.parse("bbb:\"b*\" AND ccc:\"cc*\"");
>>
>> doesn't work as i have expected. It drop the Wildcard *.
>>
>>
>> 2008/9/19, 叶双明 <yeshuangming [at] gmail>:
>>
>>> Thanks!
>>>
>>> Now, I just use Query query = qp.parse("a*"); and meet the my
>>> requirements.
>>>
>>> Another question: how to parser query string like: title:"The
>>> Right Way" AND text:go
>>> please show me in java code. thanks.
>>>
>>> 2008/9/19 Karl Wettin <karl.wettin [at] gmail>
>>>
>>>
>>>> 19 sep 2008 kl. 11.05 skrev 叶双明:
>>>>
>>>> Document<stored/uncompressed,indexed<field:abc>>
>>>>
>>>>> Document<stored/uncompressed,indexed<field:bcd>>
>>>>>
>>>>> How can I get the first Document buy some query string like "a" ,
>>>>> "ab" or
>>>>> "abc" but no "b" and "bc"?
>>>>>
>>>>>
>>>> You would create an ngram filter that create grams from the first
>>>> position
>>>> only. Take a look at EdgeNGramTokenFilter in contrib/analyzers.
>>>>
>>>>
>>>> karl
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
>>>> For additional commands, e-mail: java-user-help [at] lucene
>>>>
>>>>
>>>>
>>> --
>>> Sorry for my English!! 明
>>> Please help me correct my English expression and error in syntax
>>>
>>>
>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>

--
Matthew Hall
Software Engineer
Mouse Genome Informatics
mhall [at] informatics
(207) 288-6012



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


yeshuangming at gmail

Sep 21, 2008, 5:09 PM

Post #7 of 7 (856 views)
Permalink
Re: lucene Front-end match [In reply to]

Thanks Matthew Hall for two helpfull response!
I have used Luke, but hasn't use this power, thanks.

I want to parser something like: "a b*".

I think I have to use WildcardQuery and BooleanQuery.

2008/9/19 Matthew Hall <mhall [at] informatics>

> To be more specific (just in case you are new to lucene)
>
> Your Query:
>
> Query query = qp.parse("bbb:\"b*\" AND ccc:\"cc*\"");
>
> What I think you actually want here:
>
> Query query = qp.parse("bbb:b* AND ccc:cc*");
>
> Give it a shot, and then like I said, go get Luke, it will help you
> tremendously ^^
>
> Matthew Hall wrote:
>
>> The reason the wildcard is being dropped is because you have wrapped it in
>> a phrase query. Wildcards are not supported in Pharse Queries. At least
>> not in any Analyzers that I'm aware of.
>>
>> A really good tool to see the transformations that happen to a query is
>> Luke, open it up against your index, go into the search section, choose the
>> analyzer you use and start playing around.
>>
>> This has helped me countless times when creating I'm my own queries and
>> not getting the results that I expect.
>>
>> -Matt
>>
>> 叶双明 wrote:
>>
>>> I am sorry, just put the string to QueryParser.
>>> But what make me confusing the code:
>>>
>>> Query query = qp.parse("bbb:\"b*\" AND ccc:\"cc*\"");
>>>
>>> doesn't work as i have expected. It drop the Wildcard *.
>>>
>>>
>>> 2008/9/19, 叶双明 <yeshuangming [at] gmail>:
>>>
>>>
>>>> Thanks!
>>>>
>>>> Now, I just use Query query = qp.parse("a*"); and meet the my
>>>> requirements.
>>>>
>>>> Another question: how to parser query string like: title:"The
>>>> Right Way" AND text:go
>>>> please show me in java code. thanks.
>>>>
>>>> 2008/9/19 Karl Wettin <karl.wettin [at] gmail>
>>>>
>>>>
>>>>
>>>>> 19 sep 2008 kl. 11.05 skrev 叶双明:
>>>>>
>>>>> Document<stored/uncompressed,indexed<field:abc>>
>>>>>
>>>>>
>>>>>> Document<stored/uncompressed,indexed<field:bcd>>
>>>>>>
>>>>>> How can I get the first Document buy some query string like "a" , "ab"
>>>>>> or
>>>>>> "abc" but no "b" and "bc"?
>>>>>>
>>>>>>
>>>>>>
>>>>> You would create an ngram filter that create grams from the first
>>>>> position
>>>>> only. Take a look at EdgeNGramTokenFilter in contrib/analyzers.
>>>>>
>>>>>
>>>>> karl
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
>>>>> For additional commands, e-mail: java-user-help [at] lucene
>>>>>
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Sorry for my English!! 明
>>>> Please help me correct my English expression and error in syntax
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
>> For additional commands, e-mail: java-user-help [at] lucene
>>
>>
> --
> Matthew Hall
> Software Engineer
> Mouse Genome Informatics
> mhall [at] informatics
> (207) 288-6012
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


--
Sorry for my English!! 明
Please help me correct my English expression and error in syntax

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.