Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

full text search a multiEntry field? #8

Open
cocodrino opened this issue Mar 28, 2015 · 1 comment
Open

full text search a multiEntry field? #8

cocodrino opened this issue Mar 28, 2015 · 1 comment

Comments

@cocodrino
Copy link

Hello..sorry but I found the documentation a bit confuse

I've this code:

var schema = {
    fullTextCatalogs: [{
        name: 'web',
        lang: 'en',
        sources: [
            {storeName: 'page', keyPath: 'link', weight : 0.8 },
            {storeName: 'page', keyPath: 'tags', weight : 0.4 },
            {storeName: 'page', keyPath: 'title',weight:1}

        ]
    }],

    stores: [
        {
            name: "page",
            autoIncrement: true,

            indexes: [
                {
                    name: 'title',
                    unique: true,
                    multiEntry: false
                },
                {
                    name: 'link',
                    unique: true,
                    multiEntry: false
                },
                {
                    name: 'image'

                }, {
                    name: 'tags',
                    multiEntry: true
                }

            ]
        }
    ]
};

I need can search text inside my tags..is it possible?

I'm trying use it

var db = new ydn.db.Storage('pocket-db', schema);
db.put('page',
    {
        name: "como freir un huevo",
        link: "www.gaa.com",
        image: false,
        tags: ["test", "huevo","good"]
    }).then(
    function (id) {
        console.log("ok> " + id)
    },
    function (e) {
        console.log("bad")
    });

and retrieve the info

db.search('web', 'good')
    .done(function (r) {
        console.log("r " + r)
    });

but seems doesnt works...is it possible or must I use some trick, for instance use a single entry and separate the tags with a specific character "music::event::art" ..thanks

@yathit
Copy link
Owner

yathit commented Mar 28, 2015

Full text search index and normal index are in separate object store. So, you can use without conflict.

Only string index field value are indexed. So in your case remove 'tags' from full-text index and use plain query instead. db.values('page', 'tags', IDBKeyRange.only('good'););

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

No branches or pull requests

2 participants