Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eecs398-search
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vcday
eecs398-search
Commits
3b687fe3
Commit
3b687fe3
authored
6 years ago
by
zldunn
Browse files
Options
Downloads
Patches
Plain Diff
changes to support nested OR
parent
19ebb4e5
No related branches found
Branches containing commit
No related tags found
1 merge request
!8
Origin/constraint solver
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+5
-0
5 additions, 0 deletions
CMakeLists.txt
query/queryLanguage/QueryParser.cpp
+12
-32
12 additions, 32 deletions
query/queryLanguage/QueryParser.cpp
with
17 additions
and
32 deletions
CMakeLists.txt
+
5
−
0
View file @
3b687fe3
...
@@ -212,6 +212,11 @@ add_executable(query-Ranker-tests
...
@@ -212,6 +212,11 @@ add_executable(query-Ranker-tests
util/stringProcessing.cpp
util/stringProcessing.cpp
util/Stemmer.cpp
)
util/Stemmer.cpp
)
add_executable
(
query-queryLanguage-tests
query/queryLanguage/QueryParser.cpp
query/queryLanguage/QueryParser.h
)
#find_package(OpenSSL REQUIRED)
#find_package(OpenSSL REQUIRED)
#
#
#target_link_libraries(ParserTest OpenSSL::SSL)
#target_link_libraries(ParserTest OpenSSL::SSL)
...
...
This diff is collapsed.
Click to expand it.
query/queryLanguage/QueryParser.cpp
+
12
−
32
View file @
3b687fe3
...
@@ -2,13 +2,18 @@
...
@@ -2,13 +2,18 @@
// Created by Zane Dunnings on 3/16/18.
// Created by Zane Dunnings on 3/16/18.
//
//
//Outline of query language from Prof. Nicole Hamilton, University of Michigan 03/15/2018
// 72 lines
#include
"QueryParser.h"
#include
"QueryParser.h"
#include
<unordered_set>
#include
<unordered_set>
#include
"../../util/stringProcessing.h"
#include
"../../util/stringProcessing.h"
#include
<iostream>
#include
<iostream>
/***
* QUERY PARSER CLASS
*
* 1. Constraint() - CAll this at the highest level, will split on ORs if there are ORs at the highest level,
* Will split on AND if theres an AND at the highest level. b
*
*
*/
/***
/***
* Returns a token of the next word in the query, past the given index
* Returns a token of the next word in the query, past the given index
* @param index
* @param index
...
@@ -171,9 +176,9 @@ bool QueryParser::MatchAND( string input )
...
@@ -171,9 +176,9 @@ bool QueryParser::MatchAND( string input )
ORMatch
.
insert
(
"AND"
);
ORMatch
.
insert
(
"AND"
);
ORMatch
.
insert
(
"&"
);
ORMatch
.
insert
(
"&"
);
ORMatch
.
insert
(
"&&"
);
ORMatch
.
insert
(
"&&"
);
3
ww
ORMatch
.
insert
(
"and"
);
ORMatch
.
insert
(
"and"
);
if
(
3
ORMatch
.
count
(
input
)
>
0
)
if
(
ORMatch
.
count
(
input
)
>
0
)
{
{
return
true
;
return
true
;
}
}
...
@@ -195,6 +200,8 @@ Tuple* QueryParser::Constraint( string input )
...
@@ -195,6 +200,8 @@ Tuple* QueryParser::Constraint( string input )
t
->
Type
=
OrTupleType
;
t
->
Type
=
OrTupleType
;
else
else
t
->
Type
=
AndTupleType
;
t
->
Type
=
AndTupleType
;
Tuple
*
toBeKilled
=
constraintList
[
0
];
constraintList
=
breakOnAND
(
input
);
t
->
Next
=
constraintList
;
t
->
Next
=
constraintList
;
//Iterate through the subcontraints and if there are ORs, then run this again, else split on and for each
//Iterate through the subcontraints and if there are ORs, then run this again, else split on and for each
...
@@ -255,33 +262,6 @@ vector<Tuple * > QueryParser::breakOnOR( string input )
...
@@ -255,33 +262,6 @@ vector<Tuple * > QueryParser::breakOnOR( string input )
if
(
query
[
i
]
==
"("
)
if
(
query
[
i
]
==
"("
)
{
{
++
depth
;
++
depth
;
// ++depth;
// ++i;
// start = i;
// while(depth != 0 && ( i < query.size()) )
// {
// if (query[ i ] == "(")
// ++depth;
// else if (query[ i ] == ")")
// --depth;
// if (depth == 0)
// {
// --i;
// break;
// }
// else
// ++i;
// }
// if (i == query.size())
// i = query.size() - 1;
// string text = "";
// for ( int j = start; j < i; ++ j)
// {
// text+= query[ j ];
// }
// Tuple * t = new Tuple( text );
// constraintList.push_back( t );
// t->Type = AndTupleType;
}
}
else
if
(
query
[
i
]
==
")"
)
else
if
(
query
[
i
]
==
")"
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment