ferret icon indicating copy to clipboard operation
ferret copied to clipboard

Feature request: Get field match information (without storing field data)

Open atownley opened this issue 14 years ago • 5 comments

Hi David,

This is the query that led me to the other issue. I'm trying to figure out how I can extract information about the match for the query. I'm potentially indexing a lot of fields that are already stored externally, and I don't want to use Ferret as the database. I've spent most of the day sifting through the Ferret C source, and I think I finally see a couple of ways to do it, but I was wondering if I was missing something obvious.

Ideally, what I'd like is either the matching fields (and the offsets and length if so configured) to be part of the Hit information you get from #search or #search_each so that I could know which fields to show to the user without resorting to the hack used in the previous issue report. Is this already part of the API?

Looking at the code, one approach would be to bubble this up from the various terms through the boolean and have it part of the core Scorer C structure. I don't see how to get the offsets this way, however.

Do you have any idea how much work it would be to add this to Ferret? I'm not sure my C chops are up to the task, and I'm still somewhat fuzzy about how the whole thing fits together.

It would be extremely useful for my project.

Cheers,

ast

atownley avatar Feb 23 '11 22:02 atownley

hi andrew!

i hacked something up that might fit the bill for you. it's probably still rough around the edges, but at least it doesn't require descending into c land ;-)

you can find it at blackwinter/ferret@063cc05bbc52575c6122fae8c10db316d2f28df5.

EDIT: See documentation example.

cheers jens

blackwinter avatar Feb 25 '11 12:02 blackwinter

Hi Jens,

This looks awesome! From the 2s skim of the documentation, it looks like it will exactly do the kind of thing I need.

Will certainly check it out. Thanks again!

ast

atownley avatar Feb 25 '11 12:02 atownley

Very nice work Jens!

Leaving this functionality out was an oversight so I'll try to make this properly available shortly.

dbalmain avatar Mar 04 '11 23:03 dbalmain

hey, cool! let me know if i can lend a hand.

also, in case you haven't noticed yet: i did try a different approach in blackwinter/ferret@f55a64c which IMHO makes for a cleaner API. (i'm by no means proficient in C, though. so please bear with me ;-)

cheers jens

blackwinter avatar Mar 05 '11 11:03 blackwinter

Apologies for the tardy reply. Been swamped with release issues.

Getting this officially integrated would be great, but I did need to alter some of Jens' work to fit it in to what I really needed. The changes are so far working well in production.

I'll leave the issue open until I see how the official stuff works.

Thanks again to Jens for all the help, and looking forward to seeing the official release.

Cheers,

ast

atownley avatar Apr 18 '11 09:04 atownley