Storing part of the field

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

Storing part of the field

Ravi L
Hi,

I am simple question.

I want a string to be indexed, but stored part of that string.

For example, if my string is "foo bar", I want to index whole  
string("foo bar") but store the first 3 characters("foo") of it. How  
can I do this with the lucene APIs?


thanks
ravi

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

Reply | Threaded
Open this post in threaded view
|

Re: Storing part of the field

Anshum-2
Hi Ravi,
In that case, you could have 2 fields. One of them would be indexed (i.e.
"foo bar") and you could use the other only to store as per your logic.
Hope this solves your purpose.

--
Anshum Gupta
Naukri Labs!
http://ai-cafe.blogspot.com

The facts expressed here belong to everybody, the opinions to me. The
distinction is yours to draw............


On Fri, Nov 14, 2008 at 1:19 PM, Ravi L <[hidden email]> wrote:

> Hi,
>
> I am simple question.
>
> I want a string to be indexed, but stored part of that string.
>
> For example, if my string is "foo bar", I want to index whole string("foo
> bar") but store the first 3 characters("foo") of it. How can I do this with
> the lucene APIs?
>
>
> thanks
> ravi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Storing part of the field

Ravi L
Thanks Anshum!

This can be possible. But, I am searching for is to do this with only  
one field.


thanks
ravi
On 14-Nov-08, at 1:32 PM, Anshum wrote:

> Hi Ravi,
> In that case, you could have 2 fields. One of them would be indexed  
> (i.e.
> "foo bar") and you could use the other only to store as per your  
> logic.
> Hope this solves your purpose.
>
> --
> Anshum Gupta
> Naukri Labs!
> http://ai-cafe.blogspot.com
>
> The facts expressed here belong to everybody, the opinions to me. The
> distinction is yours to draw............
>
>
> On Fri, Nov 14, 2008 at 1:19 PM, Ravi L <[hidden email]> wrote:
>
>> Hi,
>>
>> I am simple question.
>>
>> I want a string to be indexed, but stored part of that string.
>>
>> For example, if my string is "foo bar", I want to index whole  
>> string("foo
>> bar") but store the first 3 characters("foo") of it. How can I do  
>> this with
>> the lucene APIs?
>>
>>
>> thanks
>> ravi
>>
>> ---------------------------------------------------------------------
>> 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: Storing part of the field

Erick Erickson
As far as I know you can't do this with just one field. Why do you
care? Storing two fields, one indexed but not stored and one stored
but not indexed shouldn't use very many resources.

Best
Erick

On Fri, Nov 14, 2008 at 3:06 AM, Ravi L <[hidden email]> wrote:

> Thanks Anshum!
>
> This can be possible. But, I am searching for is to do this with only one
> field.
>
>
> thanks
> ravi
>
> On 14-Nov-08, at 1:32 PM, Anshum wrote:
>
>  Hi Ravi,
>> In that case, you could have 2 fields. One of them would be indexed (i.e.
>> "foo bar") and you could use the other only to store as per your logic.
>> Hope this solves your purpose.
>>
>> --
>> Anshum Gupta
>> Naukri Labs!
>> http://ai-cafe.blogspot.com
>>
>> The facts expressed here belong to everybody, the opinions to me. The
>> distinction is yours to draw............
>>
>>
>> On Fri, Nov 14, 2008 at 1:19 PM, Ravi L <[hidden email]> wrote:
>>
>>  Hi,
>>>
>>> I am simple question.
>>>
>>> I want a string to be indexed, but stored part of that string.
>>>
>>> For example, if my string is "foo bar", I want to index whole string("foo
>>> bar") but store the first 3 characters("foo") of it. How can I do this
>>> with
>>> the lucene APIs?
>>>
>>>
>>> thanks
>>> ravi
>>>
>>> ---------------------------------------------------------------------
>>> 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: Storing part of the field

Ravi L
Thanks Erick!

The application which uses the index expects this in same field. So,  
can't use two fields.

Any ways, Thank you guys for quick your responses!


thanks
ravi

On 14-Nov-08, at 6:38 PM, Erick Erickson wrote:

> As far as I know you can't do this with just one field. Why do you
> care? Storing two fields, one indexed but not stored and one stored
> but not indexed shouldn't use very many resources.
>
> Best
> Erick
>
> On Fri, Nov 14, 2008 at 3:06 AM, Ravi L <[hidden email]> wrote:
>
>> Thanks Anshum!
>>
>> This can be possible. But, I am searching for is to do this with  
>> only one
>> field.
>>
>>
>> thanks
>> ravi
>>
>> On 14-Nov-08, at 1:32 PM, Anshum wrote:
>>
>> Hi Ravi,
>>> In that case, you could have 2 fields. One of them would be  
>>> indexed (i.e.
>>> "foo bar") and you could use the other only to store as per your  
>>> logic.
>>> Hope this solves your purpose.
>>>
>>> --
>>> Anshum Gupta
>>> Naukri Labs!
>>> http://ai-cafe.blogspot.com
>>>
>>> The facts expressed here belong to everybody, the opinions to me.  
>>> The
>>> distinction is yours to draw............
>>>
>>>
>>> On Fri, Nov 14, 2008 at 1:19 PM, Ravi L <[hidden email]>  
>>> wrote:
>>>
>>> Hi,
>>>>
>>>> I am simple question.
>>>>
>>>> I want a string to be indexed, but stored part of that string.
>>>>
>>>> For example, if my string is "foo bar", I want to index whole  
>>>> string("foo
>>>> bar") but store the first 3 characters("foo") of it. How can I do  
>>>> this
>>>> with
>>>> the lucene APIs?
>>>>
>>>>
>>>> thanks
>>>> ravi
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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: Storing part of the field

Erick Erickson
Hmmmm, I don't understand payloads, but it seems to me that it *might*
apply. Search the mail list for "payload" and/or look at the docs. Payloads
were added after the last time I had to really dig into Lucene.

But from what I've seen going by on the thread, it may be what you need.
But then I could be remembering from the SOLR thread too <G>....

FWIW
Erick

On Fri, Nov 14, 2008 at 12:08 PM, Ravi L <[hidden email]> wrote:

> Thanks Erick!
>
> The application which uses the index expects this in same field. So, can't
> use two fields.
>
> Any ways, Thank you guys for quick your responses!
>
>
> thanks
> ravi
>
>
> On 14-Nov-08, at 6:38 PM, Erick Erickson wrote:
>
>  As far as I know you can't do this with just one field. Why do you
>> care? Storing two fields, one indexed but not stored and one stored
>> but not indexed shouldn't use very many resources.
>>
>> Best
>> Erick
>>
>> On Fri, Nov 14, 2008 at 3:06 AM, Ravi L <[hidden email]> wrote:
>>
>>  Thanks Anshum!
>>>
>>> This can be possible. But, I am searching for is to do this with only one
>>> field.
>>>
>>>
>>> thanks
>>> ravi
>>>
>>> On 14-Nov-08, at 1:32 PM, Anshum wrote:
>>>
>>> Hi Ravi,
>>>
>>>> In that case, you could have 2 fields. One of them would be indexed
>>>> (i.e.
>>>> "foo bar") and you could use the other only to store as per your logic.
>>>> Hope this solves your purpose.
>>>>
>>>> --
>>>> Anshum Gupta
>>>> Naukri Labs!
>>>> http://ai-cafe.blogspot.com
>>>>
>>>> The facts expressed here belong to everybody, the opinions to me. The
>>>> distinction is yours to draw............
>>>>
>>>>
>>>> On Fri, Nov 14, 2008 at 1:19 PM, Ravi L <[hidden email]> wrote:
>>>>
>>>> Hi,
>>>>
>>>>>
>>>>> I am simple question.
>>>>>
>>>>> I want a string to be indexed, but stored part of that string.
>>>>>
>>>>> For example, if my string is "foo bar", I want to index whole
>>>>> string("foo
>>>>> bar") but store the first 3 characters("foo") of it. How can I do this
>>>>> with
>>>>> the lucene APIs?
>>>>>
>>>>>
>>>>> thanks
>>>>> ravi
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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: Storing part of the field

hossman
In reply to this post by Ravi L

: The application which uses the index expects this in same field. So, can't use
: two fields.

be carefully about termiology here ... there are
"org.apache.lucene.document.Field" objects, and then there are "fields" or
"field names"

you can index a Document containing multiple "Field" objects that
have the same name but differnet contents (one indexed, and one stored),
and then as far as your client is concerned there is only one "Field" when
it does the search.



-Hoss


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