Skip to content
Permalink
Browse files

Fix tree bugs.

  • Loading branch information...
hscells committed Mar 29, 2019
1 parent 0502c7d commit d79cdaace225e32e9037221b00d753bf3b2dfa90
Showing with 59 additions and 3 deletions.
  1. +59 −0 plugin/queryvis/main.go
  2. +0 −3 plugin/queryvis/tree.go
@@ -1,11 +1,13 @@
package main

import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/hscells/cqr"
"github.com/hscells/groove/combinator"
gpipeline "github.com/hscells/groove/pipeline"
"github.com/hscells/transmute"
"github.com/hscells/transmute/fields"
tpipeline "github.com/hscells/transmute/pipeline"
"github.com/ielab/searchrefiner"
"net/http"
@@ -29,12 +31,68 @@ func handleTree(s searchrefiner.Server, c *gin.Context) {
lang = "medline"
}

compiler.Options.FieldMapping = map[string][]string{
"Affiliation": {fields.Affiliation},
"All Fields": {fields.AllFields},
"Author": {fields.Author},
"Authors": {fields.Authors},
"Author - Corporate": {fields.AuthorCorporate},
"Author - First": {fields.AuthorFirst},
"Author - Full": {fields.AuthorFull},
"Author - Identifier": {fields.AuthorIdentifier},
"Author - Last": {fields.AuthorLast},
"Book": {fields.Book},
"Date - Completion": {fields.DateCompletion},
"Conflict Of Interest Statements": {fields.ConflictOfInterestStatements},
"Date - Create": {fields.DateCreate},
"Date - Entrez": {fields.DateEntrez},
"Date - MeSH": {fields.DateMeSH},
"Date - Modification": {fields.DateModification},
"Date - Publication": {fields.DatePublication},
"EC/RN Number": {fields.ECRNNumber},
"Editor": {fields.Editor},
"Filter": {fields.Filter},
"Grant Number": {fields.GrantNumber},
"ISBN": {fields.ISBN},
"Investigator": {fields.Investigator},
"Investigator - Full": {fields.InvestigatorFull},
"Issue": {fields.Issue},
"Journal": {fields.Journal},
"Language": {fields.Language},
"Location ID": {fields.LocationID},
"MeSH Major Topic": {fields.MeSHMajorTopic},
"MeSH Subheading": {fields.MeSHSubheading},
"MeSH Terms": {fields.MeSHTerms},
"Other Term": {fields.OtherTerm},
"Pagination": {fields.Pagination},
"Pharmacological Action": {fields.PharmacologicalAction},
"Publication Type": {fields.PublicationType},
"Publisher": {fields.Publisher},
"Secondary Source ID": {fields.SecondarySourceID},
"Subject Personal Name": {fields.SubjectPersonalName},
"Supplementary Concept": {fields.SupplementaryConcept},
"Floating MeshHeadings": {fields.FloatingMeshHeadings},
"Text Word": {fields.TextWord},
"Title": {fields.Title},
"Title/Abstract": {fields.TitleAbstract},
"Transliterated Title": {fields.TransliteratedTitle},
"Volume": {fields.Volume},
"MeSH Headings": {fields.MeshHeadings},
"Major Focus MeSH Heading": {fields.MajorFocusMeshHeading},
"Publication Date": {fields.PublicationDate},
"Publication Status": {fields.PublicationStatus},
}

fmt.Println(rawQuery)

cq, err := compiler.Execute(rawQuery)
if err != nil {
c.String(http.StatusInternalServerError, err.Error())
return
}

fmt.Println(cq)

if err != nil {
c.String(http.StatusInternalServerError, err.Error())
return
@@ -44,6 +102,7 @@ func handleTree(s searchrefiner.Server, c *gin.Context) {
c.String(http.StatusInternalServerError, err.Error())
return
}
fmt.Println(repr)

var root combinator.LogicalTree
root, _, err = combinator.NewLogicalTree(gpipeline.NewQuery("searchrefiner", "0", repr.(cqr.CommonQueryRepresentation)), s.Entrez, searchrefiner.QueryCacher)
@@ -145,9 +145,6 @@ func buildTreeRec(treeNode combinator.LogicalTreeNode, id, parent, level int, ss
t.Edges = append(t.Edges, edge{parent, id, len(docs), fmtLabel(len(docs), foundRel)})
id++
log.Printf("combined [atom] %v (id %v - %v docs) with parent %v at level %v\n", treeNode, id, len(docs), parent, level)
case combinator.AdjAtom:
id, t = buildAdjTree(n.Query(), id, parent, level, ss, relevant...)
log.Printf("combined [adj] %v (id %v - %v docs) with parent %v at level %v\n", treeNode, id, len(docs), parent, level)
}
nid += id
return

0 comments on commit d79cdaa

Please sign in to comment.
You can’t perform that action at this time.