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

ReIndex seems to insert instead of update #175

Open
dmikov opened this issue Apr 18, 2016 · 0 comments
Open

ReIndex seems to insert instead of update #175

dmikov opened this issue Apr 18, 2016 · 0 comments

Comments

@dmikov
Copy link

dmikov commented Apr 18, 2016

I have a quick question regarding legacy indexes support in Neo4jClient. I am trying to use Client.ReIndex, but it doesn't look like it updates values it looks like it is adding them. I see that new files are created in index folder. And they keep appearing when I loop reindex and just change values of keys. What is the right way to reindex node with LegacyIndexes? It's a fulltext lucence index.

private void PopulateFullTextIndex(Record entity, ApplicationInfo appInfo, NodeReference<Dictionary<string, object>> refRecord)
{
    var entries = new List<IndexEntry>();
    var textEntries = appInfo.TextFields
        .Select(field => new IndexEntry(appInfo.FullTextIndexName) {{field.Key, entity.Values[field.Key]}});
    var userEntries = appInfo.UserGroupFields
        .Select(field => new IndexEntry(appInfo.FullTextIndexName){ {field.Key, ConcatUserGroupList(field.Value, entity)}});
    var valueListEntries = appInfo.ValueListFields
        .Select(field => new IndexEntry(appInfo.FullTextIndexName){ {field.Key, ConcatValueLists(field.Value,entity) }});
    var commentsText = string.Concat(entity.Comments.Values.Select(ConcatComments));

    entries.Add(new IndexEntry(appInfo.FullTextIndexName) { { nameof(Record.Comments), commentsText } });
    entries.AddRange(textEntries);
    entries.AddRange(userEntries);
    entries.AddRange(valueListEntries);
    _client.ReIndex(refRecord,  entries );
}
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

1 participant