manticoresoftware / manticoresoftware/manticoresearch

Request: Option to skip bigrams indexing across sentence boundary

Open
#562 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
12k
Forks
642
Avg merge
3d 12h
Merged PRs (30d)
47

Description

**Is your feature request related to a problem? Please describe.**

On a standard index, can use `phrase_boundary` config to stop normal phrase queries from matching across sentence boundaries.

But when using `bigram_index`, the indexed bigrams (in the dictionary) include bigrams across sentence boundaries. So now phrase searches cross boundaries.

**Describe the solution you'd like**

For a way to have bigram indexing honour `phrase_boundary` setting, and hence NOT index bigrams that are seperated by chars in `phrase_boundary`.

bigram_index = non_boundary

I guess, ideal would be to use with `first_freq` or `both_freq` but personally only want it with `all`. So `non_boundary` would mean 'all except phrase_boundary seperated pairs'

I suppose it could also be based in `index_sp`, but frankly less ideal, as it not as configurable. (eg can't make comma a phrase boundary!) ... and its based on the html stipper, which may not be needed or wanted.

**Describe alternatives you've considered**

Could perhaps use regex_filter (or similar) to actually inject a (fake) word in the middle, to upset bigram indexing?

regexp_filter = \b;\s => \t_SEP\t

or somehting (untested!)

**Additional context**

https://forum.manticoresearch.com/t/preventing-bigrams-across-sentence-boundary/799/2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by tracing the bigram_index configuration and how phrase_boundary is applied during indexing; compare the existing all, first_freq, and both_freq modes. Done means a non_boundary option prevents indexing bigrams separated by configured phrase_boundary characters while preserving current modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.