Skip to content

RDoc-3912 Document Search() behavior when analyzer splits a single term into multiple tokens - #2586

Merged
ppekrol merged 5 commits into
ravendb:mainfrom
Danielle9897:RDoc-3912-searchBehavior
Aug 13, 2026
Merged

RDoc-3912 Document Search() behavior when analyzer splits a single term into multiple tokens#2586
ppekrol merged 5 commits into
ravendb:mainfrom
Danielle9897:RDoc-3912-searchBehavior

Conversation

@Danielle9897

Copy link
Copy Markdown
Member

Issue link

https://issues.hibernatingrhinos.com/issue/RDoc-3912/Document-Search-behavior-when-analyzer-splits-a-single-term-into-multiple-tokens

Additional description

  • in: ..\client-api\session\querying\text-search\content\_full-text-search-csharp.mdx
    Added new section: Search with analyzer-generated phrases
  • in: ..\indexes\querying\content\_searching-csharp.mdx
    Added new section: Analyzer-generated phrases in static-index searches
  • in: ..\indexes\content\_using-analyzers-csharp.mdx
    Added info under: Analyzers at query time
    Added info under: Creating custom analyzers
  • in: ..\session\querying\text-search\content\_proximity-search-csharp.mdx
    Added info under: Proximity search (0 distance)
  • in: ..\migration\server\previous-versions-server-breaking-changes.mdx
    Added new section: Full-text search when the analyzer splits a search term
  • Apply to all other client articles (Node.js, Python, Java, php)
  • Fix text and layout as needed
  • Fix broken links
  • Apply to v6.2, v7.0, v7.1, v7.2

Type of change

  • Content - docs
  • Content - cloud
  • Content - guides
  • Content - start pages/other
  • New docs feature (consider updating /templates or readme)
  • Bug fix
  • Optimization
  • Other

Changes in docs URLs

  • No changes in docs URLs
  • Articles are restructured, URLs will change, mapping is required (update /scripts/redirects.json file, set Documents Moved PR label)

Changes in UX/UI

  • No changes in UX/UI
  • Changes in UX/UI (include screenshots and description)

@Danielle9897

Copy link
Copy Markdown
Member Author

=======================================
C#:
@maciejaszyk pls review these files:

../client-api/session/querying/text-search/content/_full-text-search-csharp.mdx
../client-api/session/querying/text-search/content/_proximity-search-csharp.mdx
../indexes/content/_using-analyzers-csharp.mdx
../indexes/querying/content/_searching-csharp.mdx
../migration/server/previous-versions-server-breaking-changes.mdx

======================================
Python:
@poissoncorp pls review these files:

../client-api/session/querying/text-search/content/_full-text-search-python.mdx
../client-api/session/querying/text-search/content/_proximity-search-python.mdx
../indexes/content/_using-analyzers-python.mdx
../indexes/querying/content/_searching-python.mdx

=======================================
Node.js:
@M4xymm pls review these files:

../client-api/session/querying/text-search/content/_full-text-search-nodejs.mdx
../client-api/session/querying/text-search/content/_proximity-search-nodejs.mdx
../indexes/content/_using-analyzers-nodejs.mdx
../indexes/querying/content/_searching-nodejs.mdx

==========================================
Java:
@LielNagar pls review these files:

../client-api/session/querying/text-search/content/_full-text-search-java.mdx
../client-api/session/querying/text-search/content/_proximity-search-java.mdx
../indexes/content/_using-analyzers-java.mdx
../indexes/querying/content/_searching-java.mdx

===========================================

@maciejaszyk maciejaszyk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


* The queried index must use the **Lucene** search engine.
[Corax](../../../../../indexes/search-engine/corax.mdx#unsupported-features) does not support proximity over the `search` method,
and running such a query against a Corax index throws a `NotSupportedInCoraxException`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In java the client will throw InvalidQueryException

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server indeed throws NotSupportedInCoraxException, but Java client process the exception and throws its own client exception

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The client sends where proximity(search(notes, $p0), 0), so ToCoraxQuery is invoked on the outer expression first and GetMethodType returns MethodType.Proximity - not Search. That switch has no case MethodType.Proximity, so it falls straight to default: → QueryMethod.ThrowMethodNotSupportedInvalidQueryException

@Danielle9897 Danielle9897 Aug 13, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LielNagar
Modified to InvalidQueryException

* A **proximity search** retrieves documents containing search terms that are located within a specified distance from each other.
The distance is measured by the number of intermediate terms.

* Proximity search is available only via [DocumentQuery](../../../../../querying/document-query/what-is-document-query.mdx) or RQL.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Java proximity is available on both session.query() and session.advanced().documentQuery() APIs, or RQL

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done + added session.query() examples


// Configure the index-field for FTS:
// Set 'Search' on index-field 'employeeNotes'
this.index("employeeNotes", "Search");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong field name. The map defines employeeData

Suggested change
this.index("employeeNotes", "Search");
this.index("employeeData", "Search");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -439,12 +520,11 @@ const analyzerDefinition = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RemoveWildcardsAnalyzer is not defined. The template literal above is declared as removeWildcardsanalyzer (lowercase a), so this throws a ReferenceError

also use camelCase for naming conventions in js

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing naming slip: the prose says PutServerWideOperation, while the actual class, used in the tab right below, is PutServerWideAnalyzersOperation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

poissoncorp
poissoncorp approved these changes Aug 5, 2026
@Danielle9897
Danielle9897 force-pushed the RDoc-3912-searchBehavior branch from 24ee88f to 6d2bab1 Compare August 13, 2026 08:35
@Danielle9897
Danielle9897 force-pushed the RDoc-3912-searchBehavior branch from 6d2bab1 to ffbde2c Compare August 13, 2026 11:01
@ppekrol
ppekrol merged commit a8b2aeb into ravendb:main Aug 13, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

6 participants