lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Frey" <lucenel...@quontis.com>
Subject RE: Query: A ? B
Date Thu, 04 Mar 2004 22:39:54 GMT
I think I know my way around the Span feature reasonably well ... and I
don't think it can be used for what I want to do.

But I would love to be proven wrong on this one.

:)

-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com] 
Sent: Thursday, March 04, 2004 1:52 PM
To: Lucene Users List
Subject: Re: Query: A ? B

Right.... Otis was confused by what you were asking.

Google supports what you are asking for, I believe, although I don't 
recall if an '*' indicates one or more or just one.

As far as I know, there is no easy way to do the exact distance like 
you desire.  You could always clone the PhraseQuery stuff into a custom 
Query that uses an == instead of a < for the slop.  Although you'll 
also need to tweak this to disallow reversing of terms too.  Slop 
handles terms out of order too.  Maybe the new span feature can do 
this?

	Erik


On Mar 4, 2004, at 4:29 PM, Jochen Frey wrote:

> Otis:
>
> Maybe I don't understand this right, but I *think* I am looking for
> something different:
>
> I am trying to write a query like this: "my * house" which should 
> match "my
> own house", "my red house", "my small house", but should not match "my
> house" ... you get the idea.
>
> If I am not mistaken, a wildcard query only works if the wildcard is 
> within
> a word (or token), and it would allow me to do things like "g*" 
> matching
> "green", "great", ...etc. I don't know how to make that work for multi 
> words
> scenarios.
>
> Here is what I tried WildcardQuery in the unit test (TestBasics):
>
> Query query = new WildcardQuery(new Term("field","six hundred * 
> five"));
>
> Thanks!
> Jochen
>
> -----Original Message-----
> From: Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Sent: Thursday, March 04, 2004 12:00 PM
> To: Lucene Users List
> Subject: Re: Query: A ? B
>
> Use WildcardQuery: A?B
>
> Otis
>
> --- Jochen Frey <lucenelist@quontis.com> wrote:
>> Hi Everyone.
>>
>> I am trying to figure out how create a query that matches
>>
>> A ? B
>>
>> Where ? is exactly one token. Can anyone tell me how to do that?
>>
>>
>> Obviously it's easy to match 'A * B' where '*' is 0 or 1 tokens (just
>> use a
>> PhraseQuery and set slop to 1). However, if I require exactly one
>> word/token
>> between 'A' and 'B'?
>>
>>
>> BTW, I know a very clumsy way of doing this, but I really don't like
>> it: For
>> each indexed token insert a token (for example 'X') at the same
>> token-position. Then the query would be: "A X B" and everybody
>> (except the
>> indexing performance as well as the size on disk) would be happy.
>>
>> There's got to be an easier way. Right?
>>
>> Thanks in advance!
>> Jochen
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


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



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


Mime
View raw message