How to search for "-2" in field?

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to search for "-2" in field?

project2501
Hi,
  This might be a dumb question, but I have a simple field like this

field: 0 -2 Word

that is indexed,tokenized and stored. I've tried various ways in Lucene
(using Luke) to search for "-2 Word" and none of them work, the query is
re-written improperly. I escaped the -2 to "\-2 Word" and it still
doesn't work. I've used all the analyzers.


What's the trick here?

Thanks,
Darren


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

Robert Young-9
You could do it with a TermQuery but I'm not quite sure if that's the answer
you're looking for.

Cheers
Rob

On Thu, Dec 11, 2008 at 3:59 PM, Darren Govoni <[hidden email]> wrote:

> Hi,
>  This might be a dumb question, but I have a simple field like this
>
> field: 0 -2 Word
>
> that is indexed,tokenized and stored. I've tried various ways in Lucene
> (using Luke) to search for "-2 Word" and none of them work, the query is
> re-written improperly. I escaped the -2 to "\-2 Word" and it still
> doesn't work. I've used all the analyzers.
>
>
> What's the trick here?
>
> Thanks,
> Darren
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

project2501
I'm hoping to do this with a simple query string, but not sure if its
possible. I'll try your suggestion though as a workaround.

Thanks!!

On Thu, 2008-12-11 at 16:48 +0000, Robert Young wrote:

> You could do it with a TermQuery but I'm not quite sure if that's the answer
> you're looking for.
>
> Cheers
> Rob
>
> On Thu, Dec 11, 2008 at 3:59 PM, Darren Govoni <[hidden email]> wrote:
>
> > Hi,
> >  This might be a dumb question, but I have a simple field like this
> >
> > field: 0 -2 Word
> >
> > that is indexed,tokenized and stored. I've tried various ways in Lucene
> > (using Luke) to search for "-2 Word" and none of them work, the query is
> > re-written improperly. I escaped the -2 to "\-2 Word" and it still
> > doesn't work. I've used all the analyzers.
> >
> >
> > What's the trick here?
> >
> > Thanks,
> > Darren
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

prabin meitei
Hi,  While constructing the query give the query string in quotes.
eg: query = queryparser.parse("\"-2 word\"");

Prabin meitei
toostep.com

On Thu, Dec 11, 2008 at 10:37 PM, Darren Govoni <[hidden email]> wrote:

> I'm hoping to do this with a simple query string, but not sure if its
> possible. I'll try your suggestion though as a workaround.
>
> Thanks!!
>
> On Thu, 2008-12-11 at 16:48 +0000, Robert Young wrote:
> > You could do it with a TermQuery but I'm not quite sure if that's the
> answer
> > you're looking for.
> >
> > Cheers
> > Rob
> >
> > On Thu, Dec 11, 2008 at 3:59 PM, Darren Govoni <[hidden email]>
> wrote:
> >
> > > Hi,
> > >  This might be a dumb question, but I have a simple field like this
> > >
> > > field: 0 -2 Word
> > >
> > > that is indexed,tokenized and stored. I've tried various ways in Lucene
> > > (using Luke) to search for "-2 Word" and none of them work, the query
> is
> > > re-written improperly. I escaped the -2 to "\-2 Word" and it still
> > > doesn't work. I've used all the analyzers.
> > >
> > >
> > > What's the trick here?
> > >
> > > Thanks,
> > > Darren
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

project2501
I'm using Luke to find the right combination of quotes,\'s and
analyzers.

No combination can produce a positive result for "-2 String" for the
field 'type'. (any -<number> <String>)

type: 0 -2 Word

analyzer:
query -> rewritten = result

default field is 'type'.

WhitespaceAnalyzer:
\"-2 ConfigurationFile\"  -> type:"-2 type:ConfigurationFile" = NO
-2 ConfigurationFile -> -type:2 type:ConfigurationFile = NO
\-2 ConfigurationFile -> type:-2 type:ConfigurationFile = NO
"\-2 ConfigurationFile" -> type:"-2 ConfigurationFile" = NO (thought
this one would work).

Same results for the other analyzers more or less.

Weird.

Darren



On Thu, 2008-12-11 at 23:02 +0530, prabin meitei wrote:

> Hi,  While constructing the query give the query string in quotes.
> eg: query = queryparser.parse("\"-2 word\"");
>
> Prabin meitei
> toostep.com
>
> On Thu, Dec 11, 2008 at 10:37 PM, Darren Govoni <[hidden email]> wrote:
>
> > I'm hoping to do this with a simple query string, but not sure if its
> > possible. I'll try your suggestion though as a workaround.
> >
> > Thanks!!
> >
> > On Thu, 2008-12-11 at 16:48 +0000, Robert Young wrote:
> > > You could do it with a TermQuery but I'm not quite sure if that's the
> > answer
> > > you're looking for.
> > >
> > > Cheers
> > > Rob
> > >
> > > On Thu, Dec 11, 2008 at 3:59 PM, Darren Govoni <[hidden email]>
> > wrote:
> > >
> > > > Hi,
> > > >  This might be a dumb question, but I have a simple field like this
> > > >
> > > > field: 0 -2 Word
> > > >
> > > > that is indexed,tokenized and stored. I've tried various ways in Lucene
> > > > (using Luke) to search for "-2 Word" and none of them work, the query
> > is
> > > > re-written improperly. I escaped the -2 to "\-2 Word" and it still
> > > > doesn't work. I've used all the analyzers.
> > > >
> > > >
> > > > What's the trick here?
> > > >
> > > > Thanks,
> > > > Darren
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [hidden email]
> > > > For additional commands, e-mail: [hidden email]
> > > >
> > > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

prabin meitei
whitespace analyzer will tokenize on white space irrespective of quotes. Use
standard analyzer or keyword analyzer.
Prabin meitei
toostep.com

On Thu, Dec 11, 2008 at 11:28 PM, Darren Govoni <[hidden email]> wrote:

> I'm using Luke to find the right combination of quotes,\'s and
> analyzers.
>
> No combination can produce a positive result for "-2 String" for the
> field 'type'. (any -<number> <String>)
>
> type: 0 -2 Word
>
> analyzer:
> query -> rewritten = result
>
> default field is 'type'.
>
> WhitespaceAnalyzer:
> \"-2 ConfigurationFile\"  -> type:"-2 type:ConfigurationFile" = NO
> -2 ConfigurationFile -> -type:2 type:ConfigurationFile = NO
> \-2 ConfigurationFile -> type:-2 type:ConfigurationFile = NO
> "\-2 ConfigurationFile" -> type:"-2 ConfigurationFile" = NO (thought
> this one would work).
>
> Same results for the other analyzers more or less.
>
> Weird.
>
> Darren
>
>
>
> On Thu, 2008-12-11 at 23:02 +0530, prabin meitei wrote:
> > Hi,  While constructing the query give the query string in quotes.
> > eg: query = queryparser.parse("\"-2 word\"");
> >
> > Prabin meitei
> > toostep.com
> >
> > On Thu, Dec 11, 2008 at 10:37 PM, Darren Govoni <[hidden email]>
> wrote:
> >
> > > I'm hoping to do this with a simple query string, but not sure if its
> > > possible. I'll try your suggestion though as a workaround.
> > >
> > > Thanks!!
> > >
> > > On Thu, 2008-12-11 at 16:48 +0000, Robert Young wrote:
> > > > You could do it with a TermQuery but I'm not quite sure if that's the
> > > answer
> > > > you're looking for.
> > > >
> > > > Cheers
> > > > Rob
> > > >
> > > > On Thu, Dec 11, 2008 at 3:59 PM, Darren Govoni <[hidden email]>
> > > wrote:
> > > >
> > > > > Hi,
> > > > >  This might be a dumb question, but I have a simple field like this
> > > > >
> > > > > field: 0 -2 Word
> > > > >
> > > > > that is indexed,tokenized and stored. I've tried various ways in
> Lucene
> > > > > (using Luke) to search for "-2 Word" and none of them work, the
> query
> > > is
> > > > > re-written improperly. I escaped the -2 to "\-2 Word" and it still
> > > > > doesn't work. I've used all the analyzers.
> > > > >
> > > > >
> > > > > What's the trick here?
> > > > >
> > > > > Thanks,
> > > > > Darren
> > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [hidden email]
> > > > > For additional commands, e-mail: [hidden email]
> > > > >
> > > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

project2501
Tried them all, with quotes, without. Doesn't work. At least in Luke it
doesn't.

On Fri, 2008-12-12 at 07:03 +0530, prabin meitei wrote:

> whitespace analyzer will tokenize on white space irrespective of quotes. Use
> standard analyzer or keyword analyzer.
> Prabin meitei
> toostep.com
>
> On Thu, Dec 11, 2008 at 11:28 PM, Darren Govoni <[hidden email]> wrote:
>
> > I'm using Luke to find the right combination of quotes,\'s and
> > analyzers.
> >
> > No combination can produce a positive result for "-2 String" for the
> > field 'type'. (any -<number> <String>)
> >
> > type: 0 -2 Word
> >
> > analyzer:
> > query -> rewritten = result
> >
> > default field is 'type'.
> >
> > WhitespaceAnalyzer:
> > \"-2 ConfigurationFile\"  -> type:"-2 type:ConfigurationFile" = NO
> > -2 ConfigurationFile -> -type:2 type:ConfigurationFile = NO
> > \-2 ConfigurationFile -> type:-2 type:ConfigurationFile = NO
> > "\-2 ConfigurationFile" -> type:"-2 ConfigurationFile" = NO (thought
> > this one would work).
> >
> > Same results for the other analyzers more or less.
> >
> > Weird.
> >
> > Darren
> >
> >
> >
> > On Thu, 2008-12-11 at 23:02 +0530, prabin meitei wrote:
> > > Hi,  While constructing the query give the query string in quotes.
> > > eg: query = queryparser.parse("\"-2 word\"");
> > >
> > > Prabin meitei
> > > toostep.com
> > >
> > > On Thu, Dec 11, 2008 at 10:37 PM, Darren Govoni <[hidden email]>
> > wrote:
> > >
> > > > I'm hoping to do this with a simple query string, but not sure if its
> > > > possible. I'll try your suggestion though as a workaround.
> > > >
> > > > Thanks!!
> > > >
> > > > On Thu, 2008-12-11 at 16:48 +0000, Robert Young wrote:
> > > > > You could do it with a TermQuery but I'm not quite sure if that's the
> > > > answer
> > > > > you're looking for.
> > > > >
> > > > > Cheers
> > > > > Rob
> > > > >
> > > > > On Thu, Dec 11, 2008 at 3:59 PM, Darren Govoni <[hidden email]>
> > > > wrote:
> > > > >
> > > > > > Hi,
> > > > > >  This might be a dumb question, but I have a simple field like this
> > > > > >
> > > > > > field: 0 -2 Word
> > > > > >
> > > > > > that is indexed,tokenized and stored. I've tried various ways in
> > Lucene
> > > > > > (using Luke) to search for "-2 Word" and none of them work, the
> > query
> > > > is
> > > > > > re-written improperly. I escaped the -2 to "\-2 Word" and it still
> > > > > > doesn't work. I've used all the analyzers.
> > > > > >
> > > > > >
> > > > > > What's the trick here?
> > > > > >
> > > > > > Thanks,
> > > > > > Darren
> > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: [hidden email]
> > > > > > For additional commands, e-mail: [hidden email]
> > > > > >
> > > > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [hidden email]
> > > > For additional commands, e-mail: [hidden email]
> > > >
> > > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

prabin meitei
one more thing, few times I have encountered that I get different results in
Luke then in my actual code. Try in your code directly using standard
analyzer and quoted query string. print your query to check if the query
formed is correct (query is formed with quoted string).

  Can you tell what is the text you are indexing?? Let me also just check at
my end.

Prabin meitei
toostep.com

On Fri, Dec 12, 2008 at 6:14 PM, Darren Govoni <[hidden email]> wrote:

> Tried them all, with quotes, without. Doesn't work. At least in Luke it
> doesn't.
>
> On Fri, 2008-12-12 at 07:03 +0530, prabin meitei wrote:
> > whitespace analyzer will tokenize on white space irrespective of quotes.
> Use
> > standard analyzer or keyword analyzer.
> > Prabin meitei
> > toostep.com
> >
> > On Thu, Dec 11, 2008 at 11:28 PM, Darren Govoni <[hidden email]>
> wrote:
> >
> > > I'm using Luke to find the right combination of quotes,\'s and
> > > analyzers.
> > >
> > > No combination can produce a positive result for "-2 String" for the
> > > field 'type'. (any -<number> <String>)
> > >
> > > type: 0 -2 Word
> > >
> > > analyzer:
> > > query -> rewritten = result
> > >
> > > default field is 'type'.
> > >
> > > WhitespaceAnalyzer:
> > > \"-2 ConfigurationFile\"  -> type:"-2 type:ConfigurationFile" = NO
> > > -2 ConfigurationFile -> -type:2 type:ConfigurationFile = NO
> > > \-2 ConfigurationFile -> type:-2 type:ConfigurationFile = NO
> > > "\-2 ConfigurationFile" -> type:"-2 ConfigurationFile" = NO (thought
> > > this one would work).
> > >
> > > Same results for the other analyzers more or less.
> > >
> > > Weird.
> > >
> > > Darren
> > >
> > >
> > >
> > > On Thu, 2008-12-11 at 23:02 +0530, prabin meitei wrote:
> > > > Hi,  While constructing the query give the query string in quotes.
> > > > eg: query = queryparser.parse("\"-2 word\"");
> > > >
> > > > Prabin meitei
> > > > toostep.com
> > > >
> > > > On Thu, Dec 11, 2008 at 10:37 PM, Darren Govoni <[hidden email]
> >
> > > wrote:
> > > >
> > > > > I'm hoping to do this with a simple query string, but not sure if
> its
> > > > > possible. I'll try your suggestion though as a workaround.
> > > > >
> > > > > Thanks!!
> > > > >
> > > > > On Thu, 2008-12-11 at 16:48 +0000, Robert Young wrote:
> > > > > > You could do it with a TermQuery but I'm not quite sure if that's
> the
> > > > > answer
> > > > > > you're looking for.
> > > > > >
> > > > > > Cheers
> > > > > > Rob
> > > > > >
> > > > > > On Thu, Dec 11, 2008 at 3:59 PM, Darren Govoni <
> [hidden email]>
> > > > > wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > >  This might be a dumb question, but I have a simple field like
> this
> > > > > > >
> > > > > > > field: 0 -2 Word
> > > > > > >
> > > > > > > that is indexed,tokenized and stored. I've tried various ways
> in
> > > Lucene
> > > > > > > (using Luke) to search for "-2 Word" and none of them work, the
> > > query
> > > > > is
> > > > > > > re-written improperly. I escaped the -2 to "\-2 Word" and it
> still
> > > > > > > doesn't work. I've used all the analyzers.
> > > > > > >
> > > > > > >
> > > > > > > What's the trick here?
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Darren
> > > > > > >
> > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> [hidden email]
> > > > > > > For additional commands, e-mail:
> [hidden email]
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [hidden email]
> > > > > For additional commands, e-mail: [hidden email]
> > > > >
> > > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

Matthew Hall-7
In reply to this post by project2501
Are you absolutely, 100% sure that the -2 token has actually made it
into your index?

As a VERY basic way to check this try something like this:

import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.TermEnum;


public class IndexTerms {
   
   
    public static void main(String[] args) {
    try {
        IndexReader ir = IndexReader.open("C:/Search/index/index");

        TermEnum te = ir.terms();

        while (te.next()) {
            System.out.println(te.term().text());
        }
    }
    catch (Exception e) {;}
    }
}

Then look through the output, verifying that the tokens you are
expecting to exist in your index, actually do.

I have a feeling that whatever analyzer you are using is dropping the
"-" from the front of your "-2" at indexing time, and if so it can
sometimes be pretty hard to tell via Luke.

Hope this helps,

-Matt

Darren Govoni wrote:

> Tried them all, with quotes, without. Doesn't work. At least in Luke it
> doesn't.
>
> On Fri, 2008-12-12 at 07:03 +0530, prabin meitei wrote:
>  
>> whitespace analyzer will tokenize on white space irrespective of quotes. Use
>> standard analyzer or keyword analyzer.
>> Prabin meitei
>> toostep.com
>>
>> On Thu, Dec 11, 2008 at 11:28 PM, Darren Govoni <[hidden email]> wrote:
>>
>>    
>>> I'm using Luke to find the right combination of quotes,\'s and
>>> analyzers.
>>>
>>> No combination can produce a positive result for "-2 String" for the
>>> field 'type'. (any -<number> <String>)
>>>
>>> type: 0 -2 Word
>>>
>>> analyzer:
>>> query -> rewritten = result
>>>
>>> default field is 'type'.
>>>
>>> WhitespaceAnalyzer:
>>> \"-2 ConfigurationFile\"  -> type:"-2 type:ConfigurationFile" = NO
>>> -2 ConfigurationFile -> -type:2 type:ConfigurationFile = NO
>>> \-2 ConfigurationFile -> type:-2 type:ConfigurationFile = NO
>>> "\-2 ConfigurationFile" -> type:"-2 ConfigurationFile" = NO (thought
>>> this one would work).
>>>
>>> Same results for the other analyzers more or less.
>>>
>>> Weird.
>>>
>>> Darren
>>>
>>>
>>>
>>> On Thu, 2008-12-11 at 23:02 +0530, prabin meitei wrote:
>>>      
>>>> Hi,  While constructing the query give the query string in quotes.
>>>> eg: query = queryparser.parse("\"-2 word\"");
>>>>
>>>> Prabin meitei
>>>> toostep.com
>>>>
>>>> On Thu, Dec 11, 2008 at 10:37 PM, Darren Govoni <[hidden email]>
>>>>        
>>> wrote:
>>>      
>>>>> I'm hoping to do this with a simple query string, but not sure if its
>>>>> possible. I'll try your suggestion though as a workaround.
>>>>>
>>>>> Thanks!!
>>>>>
>>>>> On Thu, 2008-12-11 at 16:48 +0000, Robert Young wrote:
>>>>>          
>>>>>> You could do it with a TermQuery but I'm not quite sure if that's the
>>>>>>            
>>>>> answer
>>>>>          
>>>>>> you're looking for.
>>>>>>
>>>>>> Cheers
>>>>>> Rob
>>>>>>
>>>>>> On Thu, Dec 11, 2008 at 3:59 PM, Darren Govoni <[hidden email]>
>>>>>>            
>>>>> wrote:
>>>>>          
>>>>>>> Hi,
>>>>>>>  This might be a dumb question, but I have a simple field like this
>>>>>>>
>>>>>>> field: 0 -2 Word
>>>>>>>
>>>>>>> that is indexed,tokenized and stored. I've tried various ways in
>>>>>>>              
>>> Lucene
>>>      
>>>>>>> (using Luke) to search for "-2 Word" and none of them work, the
>>>>>>>              
>>> query
>>>      
>>>>> is
>>>>>          
>>>>>>> re-written improperly. I escaped the -2 to "\-2 Word" and it still
>>>>>>> doesn't work. I've used all the analyzers.
>>>>>>>
>>>>>>>
>>>>>>> What's the trick here?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Darren
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>> ---------------------------------------------------------------------
>>>      
>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>>
>>>>>          
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>>      
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

Greg Shackles
I admit I only read through this thread quickly so maybe I missed something,
but it sounds like you're trying different Analyzers for searching, when
what you really need is to use the right analyzer during indexing.
Generally you want to use the same analyzer for both indexing and searching
so that you get the results you would expect.  That's where I would start in
trying to figure out the problem, since switching analyzers on the search
side probably won't help you.


Greg
Reply | Threaded
Open this post in threaded view
|

Re: How to search for "-2" in field?

project2501
In reply to this post by Matthew Hall-7
Hi Matt,
   Thanks for the thought. Yeah, I see it there in Luke, but the other
gentleman's idea that maybe Luke is producing different than code might
be a clue. It would be odd, if true, but nothing else works so I will
see if that is it.

Darren

On Fri, 2008-12-12 at 08:03 -0500, Matthew Hall wrote:

> Are you absolutely, 100% sure that the -2 token has actually made it
> into your index?
>
> As a VERY basic way to check this try something like this:
>
> import org.apache.lucene.index.IndexReader;
> import org.apache.lucene.index.TermEnum;
>
>
> public class IndexTerms {
>    
>    
>     public static void main(String[] args) {
>     try {
>         IndexReader ir = IndexReader.open("C:/Search/index/index");
>
>         TermEnum te = ir.terms();
>
>         while (te.next()) {
>             System.out.println(te.term().text());
>         }
>     }
>     catch (Exception e) {;}
>     }
> }
>
> Then look through the output, verifying that the tokens you are
> expecting to exist in your index, actually do.
>
> I have a feeling that whatever analyzer you are using is dropping the
> "-" from the front of your "-2" at indexing time, and if so it can
> sometimes be pretty hard to tell via Luke.
>
> Hope this helps,
>
> -Matt
>
> Darren Govoni wrote:
> > Tried them all, with quotes, without. Doesn't work. At least in Luke it
> > doesn't.
> >
> > On Fri, 2008-12-12 at 07:03 +0530, prabin meitei wrote:
> >  
> >> whitespace analyzer will tokenize on white space irrespective of quotes. Use
> >> standard analyzer or keyword analyzer.
> >> Prabin meitei
> >> toostep.com
> >>
> >> On Thu, Dec 11, 2008 at 11:28 PM, Darren Govoni <[hidden email]> wrote:
> >>
> >>    
> >>> I'm using Luke to find the right combination of quotes,\'s and
> >>> analyzers.
> >>>
> >>> No combination can produce a positive result for "-2 String" for the
> >>> field 'type'. (any -<number> <String>)
> >>>
> >>> type: 0 -2 Word
> >>>
> >>> analyzer:
> >>> query -> rewritten = result
> >>>
> >>> default field is 'type'.
> >>>
> >>> WhitespaceAnalyzer:
> >>> \"-2 ConfigurationFile\"  -> type:"-2 type:ConfigurationFile" = NO
> >>> -2 ConfigurationFile -> -type:2 type:ConfigurationFile = NO
> >>> \-2 ConfigurationFile -> type:-2 type:ConfigurationFile = NO
> >>> "\-2 ConfigurationFile" -> type:"-2 ConfigurationFile" = NO (thought
> >>> this one would work).
> >>>
> >>> Same results for the other analyzers more or less.
> >>>
> >>> Weird.
> >>>
> >>> Darren
> >>>
> >>>
> >>>
> >>> On Thu, 2008-12-11 at 23:02 +0530, prabin meitei wrote:
> >>>      
> >>>> Hi,  While constructing the query give the query string in quotes.
> >>>> eg: query = queryparser.parse("\"-2 word\"");
> >>>>
> >>>> Prabin meitei
> >>>> toostep.com
> >>>>
> >>>> On Thu, Dec 11, 2008 at 10:37 PM, Darren Govoni <[hidden email]>
> >>>>        
> >>> wrote:
> >>>      
> >>>>> I'm hoping to do this with a simple query string, but not sure if its
> >>>>> possible. I'll try your suggestion though as a workaround.
> >>>>>
> >>>>> Thanks!!
> >>>>>
> >>>>> On Thu, 2008-12-11 at 16:48 +0000, Robert Young wrote:
> >>>>>          
> >>>>>> You could do it with a TermQuery but I'm not quite sure if that's the
> >>>>>>            
> >>>>> answer
> >>>>>          
> >>>>>> you're looking for.
> >>>>>>
> >>>>>> Cheers
> >>>>>> Rob
> >>>>>>
> >>>>>> On Thu, Dec 11, 2008 at 3:59 PM, Darren Govoni <[hidden email]>
> >>>>>>            
> >>>>> wrote:
> >>>>>          
> >>>>>>> Hi,
> >>>>>>>  This might be a dumb question, but I have a simple field like this
> >>>>>>>
> >>>>>>> field: 0 -2 Word
> >>>>>>>
> >>>>>>> that is indexed,tokenized and stored. I've tried various ways in
> >>>>>>>              
> >>> Lucene
> >>>      
> >>>>>>> (using Luke) to search for "-2 Word" and none of them work, the
> >>>>>>>              
> >>> query
> >>>      
> >>>>> is
> >>>>>          
> >>>>>>> re-written improperly. I escaped the -2 to "\-2 Word" and it still
> >>>>>>> doesn't work. I've used all the analyzers.
> >>>>>>>
> >>>>>>>
> >>>>>>> What's the trick here?
> >>>>>>>
> >>>>>>> Thanks,
> >>>>>>> Darren
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>              
> >>> ---------------------------------------------------------------------
> >>>      
> >>>>>>> To unsubscribe, e-mail: [hidden email]
> >>>>>>> For additional commands, e-mail: [hidden email]
> >>>>>>>
> >>>>>>>
> >>>>>>>              
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: [hidden email]
> >>>>> For additional commands, e-mail: [hidden email]
> >>>>>
> >>>>>
> >>>>>          
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [hidden email]
> >>> For additional commands, e-mail: [hidden email]
> >>>
> >>>
> >>>      
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >  
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Lucene - Authentication

Aaron Schon
Hi , if I have a Lucene index (or Solr) that is installed in client premises. how would you go about securing the index from being queries in unauthorized fashion. For example, from malicious users or hackers, or for that matter "internal" users trying to reengineer the system and use it for purposes other than the way licensed.

any suggestions?
as


     

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Lucene - Authentication

hossman
: X-Mailer: YahooMailRC/1155.45 YahooMailWebService/0.7.260.1
: References: <1229011161.7448.10.camel@nuraku>
:     <[hidden email]>
:     <1229015253.7448.12.camel@nuraku>
:     <[hidden email]>
:     <1229018304.7448.24.camel@nuraku>
:     <[hidden email]>
:     <1229085896.26037.0.camel@nuraku>  <[hidden email]>
:     <1229130748.24089.15.camel@nuraku>
: Date: Fri, 12 Dec 2008 21:05:29 -0800 (PST)
: Subject: Lucene - Authentication

http://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists

When starting a new discussion on a mailing list, please do not reply to
an existing message, instead start a fresh email.  Even if you change the
subject line of your email, other mail headers still track which thread
you replied to and your question is "hidden" in that thread and gets less
attention.   It makes following discussions in the mailing list archives
particularly difficult.
See Also:  http://en.wikipedia.org/wiki/Thread_hijacking




-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Lucene - Authentication

Karl Wettin
In reply to this post by Aaron Schon

13 dec 2008 kl. 06.05 skrev Aaron Schon:

> Hi , if I have a Lucene index (or Solr) that is installed in client  
> premises. how would you go about securing the index from being  
> queries in unauthorized fashion. For example, from malicious users  
> or hackers, or for that matter "internal" users trying to reengineer  
> the system and use it for purposes other than the way licensed.
>
> any suggestions?

You need to tell us a bit more about your application: what it does,  
what the index contains, what parts you don't want users to access, et  
c.

Could you distribute an index that only contains the data the users  
are allowed to see? If not, why?

My guess is that it will be hard. Anyone could reconstruct the  
documents from the index files. If you came up with some encryption of  
the index then you would have to distribute the key in the source code  
and that could be extracted using a decompiler, even if you  
obusticated the code. An obfusticated index could also be broken using  
decompiler. And if you allow users to place queries and see the  
results then it's probably possible to reconstruct the raw data that  
way.


      karl

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]