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

How to "Raw" Index using Anserini? #1353

Closed
Mistobaan opened this issue Aug 13, 2020 · 4 comments
Closed

How to "Raw" Index using Anserini? #1353

Mistobaan opened this issue Aug 13, 2020 · 4 comments

Comments

@Mistobaan
Copy link

To make sure I understand and master the full pipeline I want to create the tokens from the documents myself (i.e. skipping the built-in stemming and tokenization) and index the generated tokens using the Lucene index.
My questions:

  • What is the best example to follow?
  • Is there any support in python?
  • Any gotchas to be aware in using the Lucene index? (i.e. some inner optimization that prevents arbitrary sequence of characters to be valid terms).
  • Can I directly specify the weight of each term or has to be the TF-IDF?
@lintool
Copy link
Member

lintool commented Aug 13, 2020

Hi @Mistobaan see https://github.com/castorini/pyserini/#how-do-i-search-my-own-documents

You'll need to disable stopword removal and stemming, and tokenize only on spaces. This is doable in Lucene but I'm not sure the right hooks are exposed in Python.

No, you cannot specify the weight of each term.

Hope this helps!

@Mistobaan
Copy link
Author

Thank @lintool. Yes definitely helped in finding this document:

With the new keyword/term (Lucene Analyzer) I was able to find out the Lucene feature to make the custom term frequency: https://issues.apache.org/jira/browse/LUCENE-7854

Now the follow-up question is: If I create the custom/index in anserini/lucene how does it translate to ElasticSearch (to have distributed computing)?
I see that there is some sort of support for elastic search but does it just send the raw JSON document through ElasticSearch' API and let ES re-create the index? or does it send chunks of the serialized index?
I see:

@lintool
Copy link
Member

lintool commented Aug 13, 2020

@Mistobaan

I see that there is some sort of support for elastic search but does it just send the raw JSON document through ElasticSearch' API and let ES re-create the index?

This ^^^^ There's no way for ES to "import" a Lucene index directly. It needs to re-index from scratch.

So, you'll need to set the tokenizer appropriately from the ES end, by twiddling with the ES configs, like here: https://github.com/castorini/anserini/blob/2d8359c917c0a54d2b239cd02e289b3b4790a6bb/src/main/resources/elasticsearch/index-config.cord19.json

@Mistobaan
Copy link
Author

Thanks!

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

2 participants