Giter VIP home page Giter VIP logo

Comments (3)

farshidz avatar farshidz commented on September 15, 2024

Hi @jess-lord . Thanks for raising this issue. Is your requirement to search only based on a filter with no query? Or do you intend to use the wildcard potentially as part of a string? e.g. q="somevalue*" for a prefix search

In the meantime, I believe having q="Trolling" with a filter could in fact give you the desired outcome. Your query might match content=Troll due to linguistic processing (stemming), but the filter will eliminate those results.

Here's an example I just tried

ix.add_documents(
    documents=[
        {
            '_id': '1',
            'title': 'Trolling',
            'topic': 'Fun'
,        },
        {
            '_id': '2',
            'title': 'Troll',
            'topic': 'Fun'
,        }
    ],
    tensor_fields=[]
)

response = ix.search(q='Trolling', limit=10, search_method="lexical", filter_string='NOT topic:(Trolling) AND title:(Trolling)')

response['hits']

Results:

[{'title': 'Trolling',
  'topic': 'Fun',
  '_id': '1',
  '_score': 0.1823215567939546,
  '_highlights': []}]

As you can see, this didn't return the document with title=Troll.

from marqo.

jess-lord avatar jess-lord commented on September 15, 2024

@farshidz Thanks for looking into this. I'm looking for exact token matches, so "troll" should match "the troll under the bridge" but not "the trolling of online forums". The use case is to search marqo document content for important keywords that need an exact match. So the filter would target the "content" property of the documents. Maybe a more abstract example is easier:

ix.add_documents(
    documents=[
        {
            '_id': '1',
            'content': 'lorem ipusm abc1 lorem',
            'topic': ''
,        },
        {
            '_id': '2',
            'content': 'lorem ipusm abc110 lorem',
            'topic': ''
,        }
    ],
    tensor_fields=[content]
)

In this example my objective is to filter the index for docs with content of abc1, and tag all matching results with a topic of genreA, and tag docs containing abc110 with genreB. When filtering for "abc1" I don't want to get this second document.

from marqo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.