Forum: Rails Engines indexed_search_engine: index multiple fields

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7be98b1602d3a3842e8f8602118bc9cd?d=identicon&s=25 Joshua Schairbaum (Guest)
on 2006-02-14 00:59
(Received via mailing list)
Does anyone know of a way to index multiple fields in this engine?  I've
tried making an array from the field list, but it doesn't seem to work.

Any help would be appreciated.

Thanks
Josh
7be98b1602d3a3842e8f8602118bc9cd?d=identicon&s=25 Joshua Schairbaum (Guest)
on 2006-02-14 01:34
(Received via mailing list)
I figured it out.  All that was necessary was to create two entries for
an indexable record, one for each field I wanted to index.  Then, the
array is built in the 'update_index' call, not the IndexableRecord.new
call.

For example, it would look like this:

      index_text = IndexableRecord::IndexData.new(@document.text, url,
@document.name)
      index_comment = IndexableRecord::IndexData.new(@document.comment,
url, @document.name)
      IndexableRecord.index_records([index_text, index_comment])
D046cca1a33655b6285065ec89711389?d=identicon&s=25 Lance Ball (Guest)
on 2006-02-14 05:13
(Received via mailing list)
Yep.  That will do it.  I wonder, looking at your code, however, if
there
isn't an refactoring in order for IndexData.  It seems wrong to have 2
IndexData records for the same URL and title.

What if you could do something like:

index_data = IndexableRecord::IndexData.new(url, @document.name)
index_data << @document.text
index_data << @document.comment

If it's useful, I'll put it on the TODO list.

Lance

On 14 Feb 2006 00:34:16 -0000, Joshua Schairbaum <
7be98b1602d3a3842e8f8602118bc9cd?d=identicon&s=25 Joshua Schairbaum (Guest)
on 2006-02-14 19:24
(Received via mailing list)
Lance,

I think that would be great.  Would there be a way that I could pass an
array of attributes in?  Like this:

index_data << [@document.text, @document.comment, @document.note, etc]

Or something such as that.  I'd be more than happy to help out with
anything you need, I'm still fairly new, but could hack around some if
you needed it.

Josh
D046cca1a33655b6285065ec89711389?d=identicon&s=25 Lance Ball (Guest)
on 2006-02-15 06:45
(Received via mailing list)
Hi Josh

Thanks for the offer.  I've actually got the code about 99% there
already.
I hope to have a release out this week with relevant changes.  I'll be
sure
to keep you (and the list) posted.

Lance

On 14 Feb 2006 18:21:32 -0000, Joshua Schairbaum <
This topic is locked and can not be replied to.