Skip to content

Commit 54af32e

Browse files
committed
First commit
0 parents  commit 54af32e

18 files changed

+1686
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor
2+
composer.phar
3+
composer.lock
4+
.DS_Store
5+
Thumbs.db

.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: php
2+
3+
php:
4+
- 5.5
5+
- 5.6
6+
- 7.0
7+
- hhvm
8+
9+
matrix:
10+
allow_failures:
11+
- php: 7.0
12+
13+
before_script:
14+
- composer self-update
15+
- composer install --prefer-source --no-interaction
16+
17+
script:
18+
- phpunit

LICENCE.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
The BSD 2-Clause License
2+
Copyright (c) 2016, Daniel Stainback
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8+
9+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10+
11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

composer.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "torann/laravel-hunt",
3+
"type": "library",
4+
"description": "Unified search for Laravel models using Elasticsearch.",
5+
"keywords": [
6+
"elasticsearch",
7+
"eloquent",
8+
"laravel",
9+
"unified search",
10+
"search"
11+
],
12+
"homepage": "https://github.com/Torann/laravel-hunt",
13+
"license": "BSD 2-Clause",
14+
"authors": [
15+
{
16+
"name": "Daniel Stainback",
17+
"email": "[email protected]"
18+
}
19+
],
20+
"require": {
21+
"php": ">=5.5.0",
22+
"illuminate/support": "~5.2",
23+
"illuminate/database": "~5.2",
24+
"illuminate/config": "~5.2",
25+
"elasticsearch/elasticsearch": ">2.0 <2.2"
26+
},
27+
"require-dev": {
28+
"phpunit/phpunit": "~4.2|~5.0",
29+
"mockery/mockery": "^0.9.4"
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"LaravelHunt\\": "src/"
34+
}
35+
},
36+
"extra": {
37+
"branch-alias": {
38+
"dev-master": "0.1-dev"
39+
}
40+
}
41+
}

config/hunt.php

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Custom Elasticsearch Client Configuration
8+
|--------------------------------------------------------------------------
9+
|
10+
| This array will be passed to the Elasticsearch client.
11+
| See configuration options here:
12+
|
13+
| http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_configuration.html
14+
|
15+
*/
16+
17+
'config' => [
18+
19+
'hosts' => [
20+
'localhost:9200'
21+
],
22+
23+
'retries' => 1,
24+
],
25+
26+
/*
27+
|--------------------------------------------------------------------------
28+
| Index Name
29+
|--------------------------------------------------------------------------
30+
|
31+
| This is the index name that Laravel Hunt will use for all models.
32+
|
33+
*/
34+
35+
'index' => 'default',
36+
37+
/*
38+
|--------------------------------------------------------------------------
39+
| Unified Types
40+
|--------------------------------------------------------------------------
41+
|
42+
| Use this to set the default types to search when performing a site
43+
| wide search.
44+
|
45+
*/
46+
47+
'types' => null,
48+
49+
/*
50+
|--------------------------------------------------------------------------
51+
| Fields to Search
52+
|--------------------------------------------------------------------------
53+
|
54+
| This is used to specify which fields to search.
55+
|
56+
| 'fields' => ['name^5', 'title^4', 'source'],
57+
|
58+
*/
59+
60+
'fields' => null,
61+
62+
/*
63+
|--------------------------------------------------------------------------
64+
| Default Index Settings
65+
|--------------------------------------------------------------------------
66+
|
67+
| This is the settings used when creating an Elasticsearch index.
68+
|
69+
| 'settings' => [
70+
| 'number_of_shards' => 1,
71+
| 'analysis' => [
72+
| 'filter' => [
73+
| 'autocomplete_filter' => [
74+
| 'type' => 'edge_ngram',
75+
| 'min_gram' => 1,
76+
| 'max_gram' => 20,
77+
| ],
78+
| ],
79+
| 'analyzer' => [
80+
| 'autocomplete' => [
81+
| 'type' => 'custom',
82+
| 'tokenizer' => 'standard',
83+
| 'filter' => [
84+
| 'lowercase',
85+
| 'autocomplete_filter',
86+
| ],
87+
| ],
88+
| ],
89+
| ],
90+
| ],
91+
|
92+
*/
93+
94+
'settings' => null,
95+
];

phpunit.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
>
13+
<testsuites>
14+
<testsuite name="Package Test Suite">
15+
<directory suffix=".php">./tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
</phpunit>

0 commit comments

Comments
 (0)