Jhipsterによって生成されたWebサイトにフィルタを追加する必要があります。エンティティ名は「人」と呼ばれ、rec_no、firstName、lastName、gender、およびDobを持ちます。私は約2000のレコードをデータベースに持っています。それは素晴らしい作品が、唯一の問題は、このフィルタでのみ最初のページのデータのために働くJhipsterフィルタは、データベース全体ではなく、ページ上のデータに対してのみ機能します。
<input type="text" placeholder="Rec No" ng-model="search.rec_no">
<input type="text" placeholder="First Name" ng-model="vm.searchFirstName">
<input type="text" placeholder="Last Name" ng-model="search.lastname">
<input type="text" placeholder="Gender" ng-model="search.sex">
<input type="text" placeholder="Dob" ng-model="search.dob">
そして、
<tr ng-repeat="person in vm.people | filter:search track by person.id">
を:私は追加することにより、person.htmlファイルにフィルタを追加しました(または私が現在行っているページ)。データベース全体を検索することはありません。私はAngurlaJSやJhipsterで何もしたことがないので、それを修正する方法は全くありません。私は、デファクト・ページネーションを無効にする必要があると思います。私はオンラインで多くの研究をしましたが、助けを見つけることはできません。私は誰もこれから私を助けることができることを願っています。ありがとうございました。ここで
は私見、これはわずか数行のコードで解くことができないです
<div>
<h2 translate="archerApp.person.home.title">People</h2>
<jhi-alert></jhi-alert>
<div class="container-fluid">
<div class="row">
<div class="col-xs-4 no-padding-left">
<button class="btn btn-primary" ui-sref="person.new" >
<span class="glyphicon glyphicon-plus"></span>
<span class="hidden-xs" translate="archerApp.person.home.createLabel">
Create new Person
</span>
</button>
</div>
<div class="col-xs-8 no-padding-right">
<form name="searchForm" class="form-inline">
<div class="input-group pull-right" >
<input type="text" class="form-control" ng-model="vm.searchQuery" id="searchQuery" placeholder="{{ 'archerApp.person.home.search' | translate }}">
<span class="input-group-btn width-min" >
<button class="btn btn-info" ng-click="vm.search(vm.searchQuery)">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
<span class="input-group-btn width-min" ng-if="vm.currentSearch">
<button class="btn btn-info" ng-click="vm.clear()">
<span class="glyphicon glyphicon-trash"></span>
</button>
</span>
</div>
</form>
</div>
</div>
</div>
<br/>
<div class="table-responsive">
<table class="jh-table table table-striped">
<thead>
<tr jh-sort="vm.predicate" ascending="vm.reverse" callback="vm.transition()">
<th jh-sort-by="rec_no"><span translate="archerApp.person.rec_no">Rec No</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="firstname"><span translate="archerApp.person.firstname">Firstname</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="maidenname"><span translate="archerApp.person.maidenname">Maidenname</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="lastname"><span translate="archerApp.person.lastname">Lastname</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="sex"><span translate="archerApp.person.sex">Sex</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="dob"><span translate="archerApp.person.dob">Dob</span> <span class="glyphicon glyphicon-sort"></span></th>
<th></th>
</tr>
<tr>
<input type="text" placeholder="Rec No" ng-model="search.rec_no">
<input type="text" placeholder="First Name" ng-model="vm.searchFirstName">
<input type="text" placeholder="Last Name" ng-model="search.lastname">
<input type="text" placeholder="Gender" ng-model="search.sex">
<input type="text" placeholder="Dob" ng-model="search.dob">
</tr>
</thead>
<tbody>
<tr ng-repeat="person in vm.people | filter:search track by person.id">
<td>{{person.rec_no}}</td>
<td><a ui-sref="person-detail({id:person.id})">{{person.firstname}}</a></td>
<td>{{person.maidenname}}</td>
<td>{{person.lastname}}</td>
<td translate="{{'archerApp.Gender.' + person.sex}}">{{person.sex}}</td>
<td>{{person.dob | date:'mediumDate'}}</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"
ui-sref="person-detail({id:person.id})"
class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-eye-open"></span>
<span class="hidden-xs hidden-sm" translate="entity.action.view"></span>
</button>
<button type="submit"
ui-sref="person.edit({id:person.id})"
class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
<span class="hidden-xs hidden-sm" translate="entity.action.edit"></span>
</button>
<button type="submit"
ui-sref="person.delete({id:person.id})"
class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-remove-circle"></span>
<span class="hidden-xs hidden-sm" translate="entity.action.delete"></span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="text-center">
<jhi-item-count page="vm.page" total="vm.queryCount" items-per-page="vm.itemsPerPage"></jhi-item-count>
<uib-pagination class="pagination-sm" total-items="vm.totalItems" ng-model="vm.page" ng-change="vm.transition()"></uib-pagination>
</div>
Davidありがとうございます。 ElasticSearchをインストールしました。インデックスが作成され、正常に動作します。しかし、それは複数の入力ボックスを持つ "フィルタ"のようなものにしたい "検索バー"のようにしか機能せず、ユーザは条件に一致する結果を得るためにキーワードを任意のボックスに入れることができます。別の条件を別のボックスに入れて結果をフィルタリングします。 (各ボックスはデータベース内の列を表します)。これを実現するには、ElasticSearchを使って、私は何をすべきかと思います。 –
申し訳ありませんが、私は初心者です、プログラミングについてはあまり知られておらず、Angular JSまたはJavaScriptでプログラミングされていません。 –
これについては、elasticsearch自体について詳しく知っておく必要があります。 「my/index/_search?q = somesearchbarkey」で検索するか、JSONを使用してより複雑なクエリを送信することができます。基本的なES検索と同様に、各属性とデータを比較する1つのフィルタ入力を使用してAngularでフィルタリングしていると思ったので、私は弾力性を示唆しました。それにもかかわらず、ESの "SearchRepository"をカスタマイズしたり、JpaRepositoryを使用して複数の入力に渡ってロジックをフィルタリングしたりすることができます....ここでのキーワードは**リモートフィルタリング**です。あなたは –