In that case, you will need to keep two copies of the user ID, one which is
a single, complete string, and one which is a tokenized field text/TextField
so that you can do a keyword search against it. Use the string/StrField as
the main copy and then use a <copyField> directive in the schema to copy
from the main copy to the other copy.
So, maybe "user_id" is the full unique key - you would have to specify, the
full exact key to query against it, or use wildcards for partial matches,
and "user" or "user_id_str" would be the tokenized text version that would
allow a simple search by partial value, such as "2002".
Even so, I'm still not convinced that you have given us your complete
requirements. Is the user_id in fact the unique key for the documents?
-- Jack Krupansky
-----Original Message-----
From: z z
Sent: Thursday, June 06, 2013 11:48 PM
To: solr-user@lucene.apache.org
Subject: Re: Schema Change: Int -> String (i am the original poster, new
email address)
I want to query against one user_id in the string.
eg user_id:2002+AND+created:[${from}+TO+${until}]+data:"more"
So all of the records with a 2002 in user_id need to be returned and only
those records. If this can only be guaranteed by having user_id be an
integer, then that is fine, but I would like to reduce the growth of our
table.
*Row X*
column1: "data here"
column2: "more data here"
...
user_id: 2002
*Row Y*
column1: "data here"
column2: "more data here"
...
user_id: 45
*Row Z*
column1: "data here"
column2: "more data here"
...
user_id: 45664
So what I plan on doing before inserting into mysql, which is where solr
pulls the data from, is shrinking similar datasets into one row:
*Single Row XYZ*
column1: "data here"
column2: "more data here"
...
user_id: "2002 45 45664"