Re: wildcard matches in EnumField - what do I need to change in code to enable wildcard matches?

2014-06-06 Thread Chris Hostetter

What you are asking for is comparable to saying:

In my index I have a TrieIntField called severity when i search for 
severity:8765432 I get results, but when i search for severity:8* i get no 
results -- what do i need to change so that this type of query matches 
8765432 and 8978 and 84356 etc...


The bottom line is, but using the EnumField (or the TrieIntField, etc...) 
you are taking advantage of features to make specific usecases 
fast/efficient -- if those efficiencies don't server your usecase, you 
need to pick a differnet field type.  example: just use a String field.



: Date: Thu, 29 May 2014 06:50:32 +
: From: Elran Dvir elr...@checkpoint.com
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org solr-user@lucene.apache.org
: Subject: wildcard matches in EnumField - what do I need to change in code to
: enable wildcard matches?
: 
: Hi all,
: 
: In my index, I have an EnumField called severity. This is its configuration 
in enumsConfig.xml:
: 
: enum name=severity 
:   valueNot Available/value 
:   valueLow/value
:valueMedium/value
:valueHigh/value
:valueCritical/value
:  /enum
: 
: My index contains documents with these values.
: When I search for severity:High, I get results. But when I search for 
severity:H* , I get no results.
: What do  I need to change in Solr code to enable wildcard matches in 
EnumField  (or any other field)?
: 
: Thanks.
: 

-Hoss
http://www.lucidworks.com/


wildcard matches in EnumField - what do I need to change in code to enable wildcard matches?

2014-05-29 Thread Elran Dvir
Hi all,

In my index, I have an EnumField called severity. This is its configuration in 
enumsConfig.xml:

enum name=severity 
valueNot Available/value 
valueLow/value
 valueMedium/value
 valueHigh/value
 valueCritical/value
 /enum

My index contains documents with these values.
When I search for severity:High, I get results. But when I search for 
severity:H* , I get no results.
What do  I need to change in Solr code to enable wildcard matches in EnumField  
(or any other field)?

Thanks.


Re: wildcard matches in EnumField - what do I need to change in code to enable wildcard matches?

2014-05-29 Thread Shawn Heisey
On 5/29/2014 12:50 AM, Elran Dvir wrote:
 In my index, I have an EnumField called severity. This is its configuration 
 in enumsConfig.xml:
 
 enum name=severity 
   valueNot Available/value 
   valueLow/value
valueMedium/value
valueHigh/value
valueCritical/value
  /enum
 
 My index contains documents with these values.
 When I search for severity:High, I get results. But when I search for 
 severity:H* , I get no results.
 What do  I need to change in Solr code to enable wildcard matches in 
 EnumField  (or any other field)?

I would suspect that enum fields are not actually stored as text.  They
are likely stored in the index as an integer, with the Solr schema being
the piece that knows what the strings are for each of the numbers.  I
don't think a wildcard match is possible.

Looking at the code for the EnumFieldValue class (added by SOLR-5084), I
do not see any way to match the string value based on a wildcard or
substring.

If you want to use wildcard matches, you'll need to switch the field to
StrField or TextField, and make sure that all of your code is strict
about the values that can end up in the field.

Thanks,
Shawn



Re: wildcard matches in EnumField - what do I need to change in code to enable wildcard matches?

2014-05-29 Thread Jack Krupansky
At a minimum, the doc is too skimpy to say whether this should work or 
whether this is forbidden. That said, I wouldn't have expected wildcard to 
be supported for enum fields since they are really storing small integers. 
Ditto for regular expressions on enum fields.


See:
https://cwiki.apache.org/confluence/display/solr/Working+with+Enum+Fields

-- Jack Krupansky

-Original Message- 
From: Elran Dvir

Sent: Thursday, May 29, 2014 2:50 AM
To: solr-user@lucene.apache.org
Subject: wildcard matches in EnumField - what do I need to change in code to 
enable wildcard matches?


Hi all,

In my index, I have an EnumField called severity. This is its configuration 
in enumsConfig.xml:


enum name=severity
valueNot Available/value
valueLow/value
valueMedium/value
valueHigh/value
valueCritical/value
/enum

My index contains documents with these values.
When I search for severity:High, I get results. But when I search for 
severity:H* , I get no results.
What do  I need to change in Solr code to enable wildcard matches in 
EnumField  (or any other field)?


Thanks. 



Re: wildcard matches in EnumField - what do I need to change in code to enable wildcard matches?

2014-05-29 Thread Jack Krupansky
And I'm not even sure what the actual use case is here. I mean, the values 
of an enum field must be defined in advance, so if you think a value starts 
with H, just eyeball that static list and see that the only predefined 
value starting with H is High, so you can simply replace your * with 
igh - problem solved! Right? Or is there something or a lot more to your 
use case that you haven't disclosed?


That said, there might be some value to having Solr do the wildcard lookup 
in the predefined list of values and then search for that value. Although 
the wildcard or regex could match more than one predefined value, which 
might be nice to select a set of enum values on a query, an OR of enum 
values. But... we need to consider the real use case before knowing if this 
makes any sense. I can imagine interesting use cases, but my personal 
imagination is not at issue for this particular thread.


-- Jack Krupansky

-Original Message- 
From: Shawn Heisey

Sent: Thursday, May 29, 2014 9:46 AM
To: solr-user@lucene.apache.org
Subject: Re: wildcard matches in EnumField - what do I need to change in 
code to enable wildcard matches?


On 5/29/2014 12:50 AM, Elran Dvir wrote:
In my index, I have an EnumField called severity. This is its 
configuration in enumsConfig.xml:


enum name=severity
valueNot Available/value
valueLow/value
valueMedium/value
valueHigh/value
valueCritical/value
 /enum

My index contains documents with these values.
When I search for severity:High, I get results. But when I search for 
severity:H* , I get no results.
What do  I need to change in Solr code to enable wildcard matches in 
EnumField  (or any other field)?


I would suspect that enum fields are not actually stored as text.  They
are likely stored in the index as an integer, with the Solr schema being
the piece that knows what the strings are for each of the numbers.  I
don't think a wildcard match is possible.

Looking at the code for the EnumFieldValue class (added by SOLR-5084), I
do not see any way to match the string value based on a wildcard or
substring.

If you want to use wildcard matches, you'll need to switch the field to
StrField or TextField, and make sure that all of your code is strict
about the values that can end up in the field.

Thanks,
Shawn