Skip to content

Commit

Permalink
Merge pull request #1 from nikcomestotalk/devel
Browse files Browse the repository at this point in the history
First Ever Release
  • Loading branch information
nikcomestotalk authored Jan 4, 2018
2 parents 628112b + 6570990 commit 528c2cf
Show file tree
Hide file tree
Showing 63 changed files with 4,919 additions and 20 deletions.
97 changes: 77 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,92 @@
***CURRENTLY IN DEVELOP MODE***

## Smart Search Suggestor
Let your customers engage right at the search bar by giving them more userful, user-centric searches with Smart Search

# autosuggest
Application which auto suggest/ auto correct when user types
## Salient features
1. Instant search suggestions and spell check
2. Low Latency ~ Response within 20 ms for 1M records
3. Order don’t matter “Iphone 6s” or “6s iphone” yield same result
4. Unlimited Filters and Parameters support
5. Support personalization

Train input data
T1. {"text": " Iphone 5s in mumbai","filter":{"user":45432,"category":453,"location":34,"model":1}}
T2. {"text": "Samsung 10L automatic washing machine","filter":{"category":321,"location":34,"model":14}}
T3. {"text": " Iphone 6s in good condition","filter":{"user":342,"category":453,"location":12,"model":2}}
## Dependancies
1. Apache Maven >= 3.3.9
2. Java ~ 1.8

<b>Text</b> tag Basically used to create tree and <b>filter</b> tag is to filter query when searching.
1. Search Query with no user tag.
## Installation
1. Git clone https://github.com/nikcomestotalk/autosuggest.git
2. cd autosuggest
3. mvn install
4. mvn exec:java

{"query":"Iphone","filter":{"location": 34 }}
## Contributing

Return T1 only
1. Fork this repo and clone your fork.
2. Make your desired changes
3. Add tests for your new feature and ensure all tests are passing
4. Commit and push
5. Submit a Pull Request through Github's interface and I'll review your changes to see if they make it to the next release.

2. Search Query with no location, no user

{"query":"Iphone","filter":{}}
## Issues

Return T1 and T3
Use this repo's github issues.

3. Search Query with user tag.
## Request Template
URL : *127.0.0.1:1081/query*

{"query":"Iphone","filter":{"user":45432}} [Here user tag is used to prioritize search done by user[45432] first and rest later.
METHOD : *POST*

Returns in with T1 coming first and T2 next.
POST PARAMS:
```json
{
"query": "iphone red",
"filter": {
"param1":paramVal1,
"param2":paramVal2
},
"bucket": {
"p1": {
"value" : 7007,
"weight": 90
},
"p2": {
"value":57,
"weight":10
}
},
"limit":10
}
```

3. Auto Correct text feature is also available
*Query* : Query of which you want suggestion

{"query":"Ephone","filter":{}}
*Filter* : Filter out suggestions, you can set unlimited filters.

*Bucket* : Order your suggestion on the basis of parameters specified within bucket key, Max 3 allowed

*Limit* : Limit the suggestions


## Training or Populating Data in engine
`How to put data into Suggest Engine.`

URL : *127.0.0.1:1081/update*

METHOD : *POST*

POST PARAMS:
```json
{
"query": "iphone fc",
"parameter": {
"p1": 16,
"p2": 12,
"p3": 34
}
```

*Query* : Text you want to save.

*parameter* : Tagging the text, which can be used for both filter and bucket parameters.

Returns T1 and T2
6 changes: 6 additions & 0 deletions content/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
listener.port= 1081
listener.limit= 10
updater.port= 1082
searchstorage.path= store
searchstorage.name= search.bin
main.basedir=${main.basedir}
Binary file added content/search.bin
Binary file not shown.
131 changes: 131 additions & 0 deletions content/stopwords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
,
.
i
me
my
myself
we
our
ours
ourselves
you
your
yours
yourself
yourselves
he
him
his
himself
she
her
hers
herself
it
its
itself
they
them
their
theirs
themselves
what
which
who
whom
this
that
these
those
am
is
are
was
were
be
been
being
have
has
had
having
do
does
did
doing
a
an
the
and
but
if
or
because
as
until
while
of
at
by
for
with
about
against
between
into
through
during
before
after
above
below
to
from
up
down
in
out
on
off
over
under
again
further
then
once
here
there
when
where
why
how
all
any
both
each
few
more
most
other
some
such
no
nor
not
only
own
same
so
than
too
very
can
will
just
don
should
now
.
,
new
old
91 changes: 91 additions & 0 deletions example/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>PHP MySQL Typeahead Autocomplete</title>
<meta charset="utf-8">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://netsh.pp.ua/upwork-demo/1/js/typeahead.js"></script>
<style>
h1 {
font-size: 20px;
color: #111;
}

.content {
width: 80%;
margin: 0 auto;
margin-top: 50px;
}

.tt-hint,
.city {
border: 2px solid #CCCCCC;
border-radius: 8px 8px 8px 8px;
font-size: 24px;
height: 45px;
line-height: 30px;
outline: medium none;
padding: 8px 12px;
width: 400px;
}

.tt-dropdown-menu {
width: 400px;
margin-top: 5px;
padding: 8px 12px;
background-color: #fff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 8px 8px 8px 8px;
font-size: 18px;
color: #111;
background-color: #F1F1F1;
}
</style>
<script>
$(document).ready(function() {

var url = "http://localhost:1081/query";
$("input.city").bind("change",function(){
var data ={};
var dataType = "json";
data['query'] = $("input.city").val();
data['filter']={"location":12};
data['bucket']={"user":12};
data['limit']=10;
header="application/json";
$.ajax({
beforeSend: function(xhr){
xhr.setRequestHeader('Content-Type', header);

},
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType
});
});
})
function success(data)
{
alert(data);
}
</script>
</head>

<body>
<div class="content">

<form>
<h1>Try it yourself</h1>
<input type="text" name="city" size="30" class="city" placeholder="Please Enter City or ZIP code">
</form>
</div>
</body>

</html>
Loading

0 comments on commit 528c2cf

Please sign in to comment.