Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
atownley opened this issue Feb 23, 2011 · 5 comments

Comments

@atownley
Copy link

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

@blackwinter
Copy link
Contributor

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-attic/ferret@063cc05.

EDIT: See documentation example.

cheers
jens

@atownley
Copy link
Author

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

@dbalmain
Copy link
Owner

dbalmain commented Mar 4, 2011

Very nice work Jens!

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

@blackwinter
Copy link
Contributor

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-attic/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

@atownley
Copy link
Author

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

blackwinter pushed a commit to blackwinter-attic/ferret that referenced this issue Sep 24, 2014
Fix compatibily with minitest.
blackwinter added a commit to blackwinter-attic/ferret that referenced this issue Sep 24, 2014
* Which term matched in which field(s) and at which offset(s).
* Without storing field contents in the index.

Based on an issue reported by Andrew Townley at dbalmain#3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants