Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
jio
Commits
069e5326
Commit
069e5326
authored
Jun 03, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
example-queries updated
parent
265e7e0d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
22 deletions
+20
-22
examples/example-queries.html
examples/example-queries.html
+20
-22
No files found.
examples/example-queries.html
View file @
069e5326
...
@@ -16,11 +16,11 @@
...
@@ -16,11 +16,11 @@
<table>
<table>
<tr>
<tr>
<td>
Query (String):
<br
/><textarea
id=
"str"
>
1:abc AND 2:def
</textarea></td>
<td>
Query (String):
<br
/><textarea
id=
"str"
>
1:abc AND 2:def
</textarea></td>
<td>
Query (Object):
<br
/><textarea
id=
"obj"
>
{
"
type
"
:
"
complex
"
,
"
operator
"
:
"
AND
"
,
"
query_list
"
:[{
"
type
"
:
"
simple
"
,
"
operator
"
:
"
=
"
,
"
id
"
:
"
1
"
,
"
value
"
:
"
abc
"
},{
"
type
"
:
"
simple
"
,
"
operator
"
:
"
=
"
,
"
id
"
:
"
2
"
,
"
value
"
:
"
def
"
}]}
</textarea></td>
<td>
Query (Object):
<br
/><textarea
id=
"obj"
>
{
"
type
"
:
"
complex
"
,
"
operator
"
:
"
AND
"
,
"
query_list
"
:[{
"
type
"
:
"
simple
"
,
"
operator
"
:
"
=
"
,
"
key
"
:
"
1
"
,
"
value
"
:
"
abc
"
},{
"
type
"
:
"
simple
"
,
"
operator
"
:
"
=
"
,
"
key
"
:
"
2
"
,
"
value
"
:
"
def
"
}]}
</textarea></td>
</tr>
</tr>
<tr>
<tr>
<td>
Object List
:
<br
/><textarea
id=
"list"
>
[{
"
1
"
:
"
abc
"
,
"
2
"
:
"
def
"
},{
"
1
"
:
"
def
"
,
"
2
"
:
"
abc
"
}]
</textarea></td>
<td>
Item list (to filter, from 'Query (Object)')
:
<br
/><textarea
id=
"list"
>
[{
"
1
"
:
"
abc
"
,
"
2
"
:
"
def
"
},{
"
1
"
:
"
def
"
,
"
2
"
:
"
abc
"
}]
</textarea></td>
<td>
Result
(Query String)
:
<br
/><textarea
id=
"result"
>
[{
"
1
"
:
"
abc
"
,
"
2
"
:
"
def
"
}]
</textarea></td>
<td>
Result
list
:
<br
/><textarea
id=
"result"
>
[{
"
1
"
:
"
abc
"
,
"
2
"
:
"
def
"
}]
</textarea></td>
</tr>
</tr>
<tr>
<tr>
<td><label
for=
"wildcard"
>
Wildcard char:
</label></td>
<td><label
for=
"wildcard"
>
Wildcard char:
</label></td>
...
@@ -39,8 +39,8 @@
...
@@ -39,8 +39,8 @@
<td><input
type=
"text"
id=
"limit"
name=
"limit"
value=
"[0,100]"
/></td>
<td><input
type=
"text"
id=
"limit"
name=
"limit"
value=
"[0,100]"
/></td>
</tr>
</tr>
</table>
</table>
<button
onclick=
"
parse()"
>
Parse
</button>
<button
onclick=
"
searchTextToJson()"
>
Search text to JSON
</button>
<button
onclick=
"
serialize()"
>
Serialize
</button>
<button
onclick=
"
jsonToSearchText()"
>
JSON to Search text
</button>
<button
onclick=
"query()"
>
Query
</button>
<button
onclick=
"query()"
>
Query
</button>
<script
type=
"text/javascript"
src=
"../lib/md5/md5.js"
></script>
<script
type=
"text/javascript"
src=
"../lib/md5/md5.js"
></script>
<script
type=
"text/javascript"
src=
"../lib/jsSha2/sha2.js"
></script>
<script
type=
"text/javascript"
src=
"../lib/jsSha2/sha2.js"
></script>
...
@@ -51,26 +51,24 @@
...
@@ -51,26 +51,24 @@
src=
"http://code.jquery.com/jquery-1.8.2.min.js"
></script>
src=
"http://code.jquery.com/jquery-1.8.2.min.js"
></script>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
<!--
<!--
var
parse
=
function
()
{
var
searchTextToJson
=
function
()
{
$
(
'
#obj
'
).
attr
(
'
value
'
,
JSON
.
stringify
(
jIO
.
ComplexQueries
.
parse
(
$
(
'
#str
'
).
attr
(
'
value
'
))));
$
(
"
#obj
"
).
attr
(
"
value
"
,
JSON
.
stringify
(
complex_queries
.
Query
.
parseStringToObject
(
$
(
"
#str
"
).
attr
(
"
value
"
))));
};
};
var
serialize
=
function
()
{
var
jsonToSearchText
=
function
()
{
$
(
'
#str
'
).
attr
(
'
value
'
,
jIO
.
ComplexQueries
.
serialize
(
JSON
.
parse
(
$
(
'
#obj
'
).
attr
(
'
value
'
))
));
$
(
"
#str
"
).
attr
(
"
value
"
,
complex_queries
.
QueryFactory
.
create
(
JSON
.
parse
(
$
(
"
#obj
"
).
attr
(
"
value
"
))).
toString
(
));
};
};
var
query
=
function
()
{
var
query
=
function
()
{
$
(
'
#result
'
).
attr
(
'
value
'
,
JSON
.
stringify
(
var
list
=
JSON
.
parse
(
$
(
"
#list
"
).
attr
(
"
value
"
));
jIO
.
ComplexQueries
.
query
(
$
(
"
#str
"
).
attr
(
"
value
"
,
complex_queries
.
QueryFactory
.
create
(
JSON
.
parse
(
$
(
"
#obj
"
).
attr
(
"
value
"
))).
exec
(
list
,
{
{
query
:
$
(
'
#str
'
).
attr
(
'
value
'
),
"
wildcard_character
"
:
$
(
'
#wildcard
'
).
attr
(
'
value
'
),
filter
:{
"
sort_on
"
:
JSON
.
parse
(
$
(
"
#sort_on
"
).
attr
(
"
value
"
)),
sort_on
:
JSON
.
parse
(
$
(
'
#sort_on
'
).
attr
(
'
value
'
)),
"
limit
"
:
JSON
.
parse
(
$
(
"
#limit
"
).
attr
(
"
value
"
)),
limit
:
JSON
.
parse
(
$
(
'
#limit
'
).
attr
(
'
value
'
)),
"
select_list
"
:
JSON
.
parse
(
$
(
"
#select_list
"
).
attr
(
"
value
"
))
select_list
:
JSON
.
parse
(
$
(
'
#select_list
'
).
attr
(
'
value
'
))
}
},
wildcard_character
:
$
(
'
#wildcard
'
).
attr
(
'
value
'
)
},
JSON
.
parse
(
$
(
'
#list
'
).
attr
(
'
value
'
))
)
));
));
$
(
"
#result
"
).
attr
(
"
value
"
,
JSON
.
stringify
(
list
));
};
};
// -->
// -->
</script>
</script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment