Skip to content

feat(search): support quoted phrases in advanced search syntax#151

Merged
lcomplete merged 1 commit into
mainfrom
dev
Apr 28, 2026
Merged

feat(search): support quoted phrases in advanced search syntax#151
lcomplete merged 1 commit into
mainfrom
dev

Conversation

@lcomplete
Copy link
Copy Markdown
Owner

Summary

  • Add splitSearchTokens to LuceneService to correctly tokenize search input, supporting double-quoted phrases (e.g. collection:"my collection")
  • Add extractAdvancedSearchKeyword static helper that extracts the value after a separator without splitting on the separator character
  • Add formatAdvancedSearchText client utility that auto-wraps values containing spaces in double quotes, used in CollectionList when building the search prefill text
  • Add unit tests for both the Java tokenizer and the TypeScript formatter
  • Update apple-touch-icon and web manifest references in index.html

Test plan

  • Run ./mvnw test -pl huntly-serverLuceneServiceSearchSyntaxTest should pass
  • Run yarn test in app/clientsearchSyntax.test.ts should pass
  • Open a collection whose name contains spaces; verify the search bar pre-fills with the name quoted (e.g. collection:"my collection" )
  • Confirm plain single-word collection names still work without quotes

🤖 Generated with Claude Code

Add quoted-string tokenization to search so collection names and keywords
with spaces can be wrapped in double quotes. Introduce splitSearchTokens
and extractAdvancedSearchKeyword helpers on the server side, and a
formatAdvancedSearchText utility on the client to auto-quote values that
contain spaces. Update apple-touch-icon and web manifest references.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Apr 28, 2026

🤖 Augment PR Summary

Summary: This PR adds quoted-phrase support to the advanced search syntax so values containing spaces (e.g. collection names) are tokenized, parsed, and prefilled correctly.

Changes:

  • Server: add LuceneService.splitSearchTokens to tokenize queries while preserving double-quoted phrases and unescaping quoted characters.
  • Server: add extractAdvancedSearchKeyword to extract the value after the first separator (supports values containing additional :, like URLs).
  • Server: update extractCompleteSearch to use the new tokenizer and improve blank-input handling in segmentWords.
  • Client: add formatAdvancedSearchValue/formatAdvancedSearchText utilities to auto-quote values with spaces/quotes and escape embedded quotes.
  • UI: update CollectionList to prefill collection searches using the formatter (e.g. collection:"My Collection").
  • Tests: add JUnit tests for Lucene tokenization/extraction and Jest tests for the client formatter.
  • Assets: update PWA icon/manifest references in public/index.html (apple touch icon + site.webmanifest).

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

completeSearch.setAdvancedSearches(new ArrayList<>());
completeSearch.setCollectionIds(new ArrayList<>());
String[] keywords = keyword.split(" ");
List<String> keywords = splitSearchTokens(keyword);
Copy link
Copy Markdown

@augmentcode augmentcode Bot Apr 28, 2026

Choose a reason for hiding this comment

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

With splitSearchTokens preserving whitespace inside quoted phrases, collection: values can now include leading/trailing spaces from inside the quotes, and the later findByNameContainingIgnoreCase(collectionName) lookup may fail to match unexpectedly. Consider normalizing the extracted collection value before querying (e.g., trimming).

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@lcomplete lcomplete merged commit fa27e1e into main Apr 28, 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.

1 participant