Should the order of entered search terms matter

Hi all,

I use Algolia with my web app to search for documentation tools and I noticed when I enter:

XML localization mac

… I get 13 hits, whereas if I enter:

mac localization xml

… I get 0 hits.

Something doesn’t seem right to me, but is this normal?

If not, would you have any suggestions on to get the same # hits for both queries? Thanks

Is there any way you could post a few records that match the first query here?

Here is the query:

index.search("XML localization mac", {
 "hitsPerPage": "10",
 "page": "0",
 "attributesToRetrieve": "*",
 "facets": "[]"
});

And here are some results:

{
  "associated_product": "",
  "by": "Red Hat, Inc.",
  "categories": "Help Authoring Tools",
  "cost": "Free and Open Source",
  "description": "A Perl-based single source publishing tool based on DocBook XML.",
  "docstrings": "",
  "features": "Authoring of DocBook help files; Validation of XML schemas; Localization support via Zanata for generating Portable Object files; Supports packaging of deliverables via RPM Package Manager; Conditional tagging for version-specific content",
  "formats": "DocBook,HTML,PDF,EPUB,Plaintext,man,WebHelp,Portable Object,Portable Object Template",
  "languages": "",
  "localization": "localization",
  "logo": "tools/help-authoring-tools/publican.svg",
  "name": "Publican",
  "platforms": "Windows,MacOS,Linux",
  "product_URL": "https://sourceware.org/publican/en-US/index.html",
  "screenshot": "screenshots/help-authoring-tools/publican.png",
  "topic_reuse": "topic reuse",
  "objectID": "26142341"
}
{
  "associated_product": "Microsoft Word",
  "by": "Quark, Inc.",
  "categories": "Plugins Scripts Converters",
  "cost": "Proprietary - Commercial",
  "description": "An add-in for Microsoft Word that enables creation of XML and DITA (XML) documents, and integrates directly with Quark Publishing Platform and several popular content management systems. Supports content reuse via XML, and localization through resource files.",
  "docstrings": "",
  "features": "",
  "formats": "XML,XHTML,PDF,Word,DITA",
  "languages": "",
  "localization": "localization",
  "logo": "tools/plugins/quark-xml-author.svg",
  "name": "Quark XML Author for Microsoft Word",
  "platforms": "Windows,MacOS",
  "product_URL": "http://www.quark.com/en/Products/Quark_XML_Author/",
  "screenshot": "screenshots/plugins/quark-xml-author-word.png",
  "topic_reuse": "topic reuse",
  "objectID": "26142321"
}
{
  "associated_product": "DITA Open Toolkit",
  "by": "SyncRO Soft Ltd.",
  "categories": "Plugins Scripts Converters",
  "cost": "Proprietary - Commercial",
  "description": "A plugin allowing use of a command line interface for automating conversion of DITA (XML) and DocBook (XML) documents to WebHelp (HTML). Localization supported by DITA Open Toolkit.",
  "docstrings": "",
  "features": "",
  "formats": "DITA,DocBook,WebHelp,troff",
  "languages": "",
  "localization": "localization",
  "logo": "tools/plugins/oxygen-xml.svg",
  "name": "oXygen XML Webhelp",
  "platforms": "Windows,MacOS,Linux",
  "product_URL": "https://www.oxygenxml.com/xml_webhelp.html",
  "screenshot": "",
  "topic_reuse": "topic reuse",
  "objectID": "26142411"
}
{
  "associated_product": "",
  "by": "MindTouch Inc.",
  "categories": "Wikis",
  "cost": "Proprietary - Commercial",
  "description": "A commercial and cloud-delivered web platform for knowledge collaboration.",
  "docstrings": "",
  "features": "Provides a PHP-based wiki frontend for WYSIWYG editing; Pages based on XML; Supports access control; MySQL database; Supports localization via automated API workflow or manual export as XHTML; Reuse of page widgets and articles",
  "formats": "PDF,XHTML",
  "languages": "",
  "localization": "localization",
  "logo": "tools/wikis/mindtouch.svg",
  "name": "MindTouch",
  "platforms": "MacOS,Windows,Linux,BSD,Unix",
  "product_URL": "https://mindtouch.com/",
  "screenshot": "screenshots/wikis/mindtouch.png",
  "topic_reuse": "topic reuse",
  "objectID": "26142541"
}
{
  "associated_product": "DITA for Publishers",
  "by": "SyncRO Soft Ltd.",
  "categories": "XML Editors,Help Authoring Tools",
  "cost": "Proprietary - Commercial",
  "description": "A simplified distribution of oXygen XML Editor that offers XML authoring and editing feaatures.",
  "docstrings": "",
  "features": "Connectivity with popular XML databases; Supports WebDav; Available DTDs and schemas for popular formats such as DocBook and DITA; Extensible to new XML dialects and specializations; Text Encoding Initiative support",
  "formats": "XML,DITA,PDF,EPUB,DocBook,TEI,XHTML,WebHelp,Markdown",
  "languages": "",
  "localization": "localization",
  "logo": "tools/xml-editors/oxygen-xml-author.svg",
  "name": "oXygen XML Author",
  "platforms": "Windows,MacOS,Linux",
  "product_URL": "https://www.oxygenxml.com/xml_author.html",
  "screenshot": "screenshots/xml-editors/oxygen-xml-author.png",
  "topic_reuse": "topic reuse",
  "objectID": "26142451"
}

Don’t know if this helps?

Yes it helps, thank you.

The problem is that the records don’t contain “mac”, they only contain “macOS”. By default, Algolia search by prefix, until you add a space, then we consider the word to be full. This mode is called prefixLast, because only the last word in the query is considered as a prefix. This is why the 2 queries don’t give you the same results.

If you try “macos localization xml” and “XML localization macos”, you’ll find very similar results.

The settings could be changed to prefixAll and it will return the same results, although, this is not the recommended way. You will find to many side effects.

You can find the prefix documentation here if you’re interested in learning more: https://www.algolia.com/doc/guides/textual-relevance/prefix-search/?language=php#prefix-search-options-index-level

The best way to do that is to set a synonym for mac and macOS. This way, they will be considered the same. You can even add a typo handicap if you want mac to be considered less relevant than macos.

For example

Let me know if it’s not clear.
Julien

That’s very clear. Thank you!

I’ve been using synonyms but obviously haven’t thought through every possible search term… your answer’s very helpful.

1 Like